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/DTDValidationTestCase.java b/core/src/test/java/org/apache/commons/digester3/DTDValidationTestCase.java
index baeba3c35..62dc2d59f 100644
--- a/core/src/test/java/org/apache/commons/digester3/DTDValidationTestCase.java
+++ b/core/src/test/java/org/apache/commons/digester3/DTDValidationTestCase.java
@@ -17,6 +17,7 @@
package org.apache.commons.digester3;
import static org.apache.commons.digester3.binder.DigesterLoader.newLoader;
+import static org.junit.jupiter.api.Assertions.assertThrows;
import java.io.File;
@@ -29,50 +30,44 @@
/**
* Tests for entity resolution and dtd validation
*/
-public class DTDValidationTestCase
-{
+public class DTDValidationTestCase {
- @Test( expected = SAXParseException.class )
- public void testDigesterDTDError()
- throws Exception
- {
- newLoader( new AbstractRulesModule() {
-
- @Override
- protected void configure()
- {
- // do nothing
- }
-
- } )
- .setValidating( true )
- .setErrorHandler( new ErrorHandler()
- {
-
- @Override
- public void warning( final SAXParseException e )
- throws SAXException
- {
- throw e;
- }
-
- @Override
- public void fatalError( final SAXParseException e )
- throws SAXException
- {
- throw e;
- }
-
- @Override
- public void error( final SAXParseException e )
- throws SAXException
- {
- throw e;
- }
-
- } )
- .newDigester()
- .parse( new File( "src/test/resources/org/apache/commons/digester3/document-with-relative-dtd-error.xml" ) );
+ @Test
+ public void testDigesterDTDError() {
+
+ assertThrows(SAXParseException.class, () ->
+ newLoader(new AbstractRulesModule() {
+
+ @Override
+ protected void configure() {
+ // do nothing
+ }
+
+ })
+ .setValidating(true)
+ .setErrorHandler(new ErrorHandler() {
+
+ @Override
+ public void warning(final SAXParseException e)
+ throws SAXException {
+ throw e;
+ }
+
+ @Override
+ public void fatalError(final SAXParseException e)
+ throws SAXException {
+ throw e;
+ }
+
+ @Override
+ public void error(final SAXParseException e)
+ throws SAXException {
+ throw e;
+ }
+
+ })
+ .newDigester()
+ .parse(new File("src/test/resources/org/apache/commons/digester3/document-with-relative-dtd-error.xml")));
}
@Test