This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-codec.git
The following commit(s) were added to refs/heads/master by this push:
new b2bbd022 Use assertThrows()
b2bbd022 is described below
commit b2bbd02217963781c4f53a30e3179d1b53d8b23b
Author: Gary Gregory <[email protected]>
AuthorDate: Fri Feb 27 08:50:50 2026 -0500
Use assertThrows()
---
.../java/org/apache/commons/codec/binary/BinaryCodecTest.java | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/src/test/java/org/apache/commons/codec/binary/BinaryCodecTest.java
b/src/test/java/org/apache/commons/codec/binary/BinaryCodecTest.java
index 99fd4c39..374ee406 100644
--- a/src/test/java/org/apache/commons/codec/binary/BinaryCodecTest.java
+++ b/src/test/java/org/apache/commons/codec/binary/BinaryCodecTest.java
@@ -18,6 +18,7 @@
package org.apache.commons.codec.binary;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.fail;
import java.nio.charset.Charset;
@@ -519,13 +520,7 @@ class BinaryCodecTest {
*/
@Test
void testEncodeObjectException() {
- try {
- instance.encode("");
- } catch (final EncoderException e) {
- // all is well.
- return;
- }
- fail("Expected EncoderException");
+ assertThrows(EncoderException.class, () -> instance.encode(""));
}
/*