Skip to content

Commit 780cc73

Browse files
committed
Test should use JUnit's fail() instead of throwing a RuntimeExceptiom
1 parent 46efc03 commit 780cc73

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

src/changes/changes.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ The <action> type attribute can be add,update,fix,remove.
4646
<release version="1.16.1" date="20YY-MM-DD" description="Feature and fix release.">
4747
<!-- ADD -->
4848
<!-- FIX -->
49+
<action issue="CODEC-295" dev="ggregory" type="fix" due-to="Gary Gregory">Test clean ups.</action>
4950
<!-- UPDATE -->
5051
</release>
5152
<release version="1.16.0" date="2023-06-17" description="Feature and fix release.">

src/test/java/org/apache/commons/codec/digest/PureJavaCrc32Test.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package org.apache.commons.codec.digest;
1818

1919
import static org.junit.jupiter.api.Assertions.assertEquals;
20+
import static org.junit.jupiter.api.Assertions.fail;
2021

2122
import java.io.FileNotFoundException;
2223
import java.io.FileOutputStream;
@@ -294,12 +295,11 @@ private static void doBench(final List<Class<? extends Checksum>> crcs,
294295
//check result
295296
if(c == zip) {
296297
expected = result;
297-
} else if (expected == null) {
298-
throw new RuntimeException("The first class is " +
299-
c.getName() + " but not " + zip.getName());
300-
} else if (result.value != expected.value) {
301-
throw new RuntimeException(c + " has bugs!");
302-
}
298+
} else if (expected == null) {
299+
fail("The first class is " + c.getName() + " but not " + zip.getName());
300+
} else if (result.value != expected.value) {
301+
fail(c + " has bugs!");
302+
}
303303

304304
//compare result with previous
305305
for(final BenchResult p : previous) {

0 commit comments

Comments
 (0)