diff --git a/core/pom.xml b/core/pom.xml
index 8e886ddc5..6fc84ac0d 100644
--- a/core/pom.xml
+++ b/core/pom.xml
@@ -55,6 +55,11 @@
4.13
test
+
+ org.junit.jupiter
+ junit-jupiter-api
+ test
+
diff --git a/core/src/test/java/org/apache/commons/digester3/annotations/failingtests/FailingTestCase.java b/core/src/test/java/org/apache/commons/digester3/annotations/failingtests/FailingTestCase.java
index ff170b894..ef448736a 100644
--- a/core/src/test/java/org/apache/commons/digester3/annotations/failingtests/FailingTestCase.java
+++ b/core/src/test/java/org/apache/commons/digester3/annotations/failingtests/FailingTestCase.java
@@ -18,6 +18,10 @@
package org.apache.commons.digester3.annotations.failingtests;
import static org.apache.commons.digester3.binder.DigesterLoader.newLoader;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.core.Is.is;
+import static org.hamcrest.core.StringStartsWith.startsWith;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import org.apache.commons.digester3.annotations.FromAnnotationsRuleModule;
import org.apache.commons.digester3.binder.DigesterLoadingException;
@@ -29,20 +33,20 @@ public final class FailingTestCase
/**
* Tests to make sure loader fails
*/
- @Test(expected = DigesterLoadingException.class)
+ @Test
public void failsBecauseFailingDigesterLoaderHandlerFactory() {
- newLoader(new FromAnnotationsRuleModule()
- {
+ final DigesterLoadingException thrown = assertThrows(DigesterLoadingException.class, () ->
+ newLoader(new FromAnnotationsRuleModule() {
- @Override
- protected void configureRules()
- {
- useAnnotationHandlerFactory( new FailingDigesterLoaderHandlerFactory() );
- bindRulesFrom( BeanWithFakeHandler.class );
- }
+ @Override
+ protected void configureRules() {
+ useAnnotationHandlerFactory(new FailingDigesterLoaderHandlerFactory());
+ bindRulesFrom(BeanWithFakeHandler.class);
+ }
- }).newDigester();
+ }).newDigester());
+ assertThat(thrown.getMessage(), is(startsWith("Digester creation errors:")));
}
}