Skip to content

Commit

Permalink
JUnit assertThrows IncludeTest
Browse files Browse the repository at this point in the history
  • Loading branch information
nhojpatrick committed Nov 22, 2022
1 parent 3d4068d commit 018c882
Showing 1 changed file with 10 additions and 13 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.Assert.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

import java.io.StringReader;
import java.net.URL;
Expand Down Expand Up @@ -130,21 +131,17 @@ protected void loadRules()
/**
* Validates that circular includes are detected and result in an exception
*/
@Test( expected = org.apache.commons.digester3.binder.DigesterLoadingException.class )
public void testCircularInclude()
throws Exception
{
@Test
public void testCircularInclude() {
final URL url = ClassLoader.getSystemResource( "org/apache/commons/digester3/xmlrules/testCircularRules.xml" );
newLoader( new FromXmlRulesModule()
{

@Override
protected void loadRules()
{
loadXMLRules( url );
}

}).newDigester();
assertThrows(org.apache.commons.digester3.binder.DigesterLoadingException.class, () ->
newLoader(new FromXmlRulesModule() {
@Override
protected void loadRules() {
loadXMLRules(url);
}
}).newDigester());
}

}

0 comments on commit 018c882

Please sign in to comment.