Skip to content

Commit f2f4936

Browse files
Test for integer overflow (exercism#1846)
1 parent 57a3414 commit f2f4936

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

exercises/practice/largest-series-product/src/test/java/LargestSeriesProductCalculatorTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,5 +184,16 @@ public void testNegativeSeriesLengthIsRejected() {
184184
assertThat(expected)
185185
.hasMessage("Series length must be non-negative.");
186186
}
187+
188+
@Ignore("Remove to run test")
189+
@Test
190+
public void testForIntegerOverflow() {
191+
LargestSeriesProductCalculator calculator = new LargestSeriesProductCalculator("9999999999");
192+
long expectedProduct = 3486784401L;
193+
194+
long actualProduct = calculator.calculateLargestProductForSeriesLength(10);
195+
196+
assertEquals(expectedProduct, actualProduct);
197+
}
187198

188199
}

0 commit comments

Comments
 (0)