Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ static int internalEstimateEntryCountByBytesSize(int maxEntries, long maxSizeByt
Long lastLedgerId, long lastLedgerTotalEntries,
long lastLedgerTotalSize) {
if (maxSizeBytes <= 0) {
// If the specified maximum size is invalid (e.g., non-positive), return 0
return 0;
// If the specified maximum size is invalid (e.g., non-positive), return 1
return 1;
}

// If the maximum size is Long.MAX_VALUE, return the maximum number of entries
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,13 @@ private int estimateEntryCountByBytesSize(long maxSizeBytes) {
@Test
public void testZeroMaxSize() {
int result = estimateEntryCountByBytesSize(0);
assertEquals(result, 0, "Should return 0 when max size is 0");
assertEquals(result, 1, "Should return 1 when max size is 0");
}

@Test
public void testNegativeMaxSize() {
int result = estimateEntryCountByBytesSize(-1);
assertEquals(result, 1, "Should return 1 when max size is negative");
}

@Test
Expand Down