Skip to content

Commit

Permalink
JUnit assertThrows Digester171TestCase
Browse files Browse the repository at this point in the history
  • Loading branch information
nhojpatrick committed Nov 22, 2022
1 parent 3d4068d commit 47acf99
Showing 1 changed file with 14 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
*/

import static org.apache.commons.digester3.binder.DigesterLoader.newLoader;
import static org.junit.jupiter.api.Assertions.assertThrows;

import java.io.File;

Expand Down Expand Up @@ -50,26 +51,23 @@ protected void configure()
.parse( new File( "src/test/resources/org/apache/commons/digester3/document-with-relative-dtd-error.xml" ) );
}

@Test( expected = SAXParseException.class )
public void testDefaultThrowingErrorHandler()
throws Exception
{
@Test
public void testDefaultThrowingErrorHandler() {
final ErrorHandler customErrorHandler = new DefaultThrowingErrorHandler();

newLoader( new AbstractRulesModule()
{
assertThrows(SAXParseException.class, () ->
newLoader(new AbstractRulesModule() {

@Override
protected void configure()
{
// do nothing
}
@Override
protected void configure() {
// do nothing
}

} )
.setFeature( "http://xml.org/sax/features/validation", true )
.setErrorHandler( customErrorHandler )
.newDigester()
.parse( new File( "src/test/resources/org/apache/commons/digester3/document-with-relative-dtd-error.xml" ) );
})
.setFeature("http://xml.org/sax/features/validation", true)
.setErrorHandler(customErrorHandler)
.newDigester()
.parse(new File("src/test/resources/org/apache/commons/digester3/document-with-relative-dtd-error.xml")));
}

}

0 comments on commit 47acf99

Please sign in to comment.