|
25 | 25 | import static org.testng.Assert.assertEquals; |
26 | 26 | import static org.testng.Assert.assertTrue; |
27 | 27 | import static org.testng.Assert.fail; |
| 28 | +import static org.testng.Assert.assertThrows; |
28 | 29 |
|
29 | 30 | import org.apache.datasketches.common.SketchesArgumentException; |
30 | 31 | import org.apache.datasketches.thetacommon.BinomialBoundsN; |
@@ -119,17 +120,17 @@ public static void checkBounds() { |
119 | 120 |
|
120 | 121 | @Test |
121 | 122 | public static void checkCheckArgs() { |
122 | | - try { |
123 | | - checkArgs(-1L, 1.0, 1); |
124 | | - checkArgs(10L, 0.0, 1); |
125 | | - checkArgs(10L, 1.01, 1); |
126 | | - checkArgs(10L, 1.0, 3); |
127 | | - checkArgs(10L, 1.0, 0); |
128 | | - checkArgs(10L, 1.0, 4); |
129 | | - fail("Expected SketchesArgumentException"); |
130 | | - } catch (final SketchesArgumentException e) { |
131 | | - //pass |
132 | | - } |
| 123 | + assertThrows(SketchesArgumentException.class, |
| 124 | + () -> checkArgs(-1L, 1.0, 1)); |
| 125 | + assertThrows(SketchesArgumentException.class, |
| 126 | + () -> checkArgs(10L, 0.0, 1)); |
| 127 | + assertThrows(SketchesArgumentException.class, |
| 128 | + () -> checkArgs(10L, 1.01, 1)); |
| 129 | + checkArgs(10L, 1.0, 3); |
| 130 | + assertThrows(SketchesArgumentException.class, |
| 131 | + () -> checkArgs(10L, 1.0, 0)); |
| 132 | + assertThrows(SketchesArgumentException.class, |
| 133 | + () -> checkArgs(10L, 1.0, 4)); |
133 | 134 | } |
134 | 135 |
|
135 | 136 | @Test |
|
0 commit comments