Skip to content
Open
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 @@ -106,11 +106,12 @@ public Serializable[][] getParameterValues() {

Serializable[][] parameters = new Serializable[batchNum][2];
long start = minVal;
for (int i = 0; i < batchNum; i++) {
for (int i = 0; i < batchNum - 1; i++) {
long end = start + batchSize - 1 - (i >= bigBatchNum ? 1 : 0);
parameters[i] = new Long[] {start, end};
start = end + 1;
}
parameters[batchNum - 1] = new Long[] {start, maxVal};
return parameters;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,21 @@ void testBatchNumTooLarge() {
check(expected, actual);
}

@Test
void testBatchMaxMinTooLarge() {
JdbcNumericBetweenParametersProvider provider =
new JdbcNumericBetweenParametersProvider(2260418954055131340L, 3875220057236942850L)
.ofBatchSize(3);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean that we should call the ofBatchNum method here?

Serializable[][] actual = provider.getParameterValues();

long[][] expected = {
new long[] {2260418954055131340L, 2798685988449068510L},
new long[] {2798685988449068511L, 3336953022843005681L},
new long[] {3336953022843005682L, 3875220057236942850L}
};
Comment on lines +125 to +129
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
long[][] expected = {
new long[] {2260418954055131340L, 2798685988449068510L},
new long[] {2798685988449068511L, 3336953022843005681L},
new long[] {3336953022843005682L, 3875220057236942850L}
};
long[][] expected = {
new long[] {2260418954055131340L, 2798685988449068491L},
new long[] {2798685988449068492L, 3336953022843005643L},
new long[] {3336953022843005644L, 3875220057236942850L}
};
image

I tried to follow your train of thought to review this test case. Perhaps you were trying to convey this expected outcome. Please let me know your opinion.

check(expected, actual);
}

private void check(long[][] expected, Serializable[][] actual) {
assertThat(actual).hasDimensions(expected.length, expected[0].length);
for (int i = 0; i < expected.length; i++) {
Expand Down