Skip to content

Commit 871515d

Browse files
author
jbradley
committed
updated test case exception handling
1 parent 0e3d83b commit 871515d

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/test/java/problems/impl/DigitalRootCalculatorImplTest.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,21 @@ public List<Integer> identifyDigits(final long number) {
6565
};
6666
private final DigitalRootCalculator expectedBehaviorDigitalRootCalculator = new DigitalRootCalculatorImpl(expectedBehaviorListSummator, expectedBehaviorDigitsIdentifier);
6767

68-
@Test(expected = RuntimeException.class)
68+
@Test
6969
public void itShouldThrowException() {
70-
negativeDigitalRootCalculator.calculateDigitalRoot(10);
71-
constantPositiveDigitalRootCalculator.calculateDigitalRoot(10);
70+
try {
71+
negativeDigitalRootCalculator.calculateDigitalRoot(10);
72+
Assert.fail();
73+
} catch (RuntimeException e) {
74+
// expected
75+
}
76+
77+
try {
78+
constantPositiveDigitalRootCalculator.calculateDigitalRoot(10);
79+
Assert.fail();
80+
} catch (RuntimeException e) {
81+
// expected
82+
}
7283
}
7384

7485
@Test

0 commit comments

Comments
 (0)