File tree Expand file tree Collapse file tree
core/src/test/java/org/apache/commons/digester3/xmlrules Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2020
2121import static org .apache .commons .digester3 .binder .DigesterLoader .newLoader ;
2222import static org .junit .Assert .assertEquals ;
23+ import static org .junit .jupiter .api .Assertions .assertThrows ;
2324
2425import java .io .StringReader ;
2526import java .net .URL ;
3031import org .apache .commons .digester3 .Rule ;
3132import org .apache .commons .digester3 .binder .AbstractRulesModule ;
3233import org .junit .Test ;
34+ import org .junit .jupiter .api .function .Executable ;
3335
3436/**
3537 * Test for the include class functionality
@@ -130,21 +132,25 @@ protected void loadRules()
130132 /**
131133 * Validates that circular includes are detected and result in an exception
132134 */
133- @ Test ( expected = org .apache .commons .digester3 .binder .DigesterLoadingException .class )
134- public void testCircularInclude ()
135- throws Exception
136- {
135+ @ Test
136+ public void testCircularInclude () {
137137 final URL url = ClassLoader .getSystemResource ( "org/apache/commons/digester3/xmlrules/testCircularRules.xml" );
138- newLoader ( new FromXmlRulesModule ()
139- {
140138
139+ // FIXME Simplification once upgraded to Java 1.8 and use lambda
140+ final Executable testMethod = new Executable () {
141141 @ Override
142- protected void loadRules ()
143- {
144- loadXMLRules ( url );
145- }
142+ public void execute () throws Throwable {
143+ newLoader (new FromXmlRulesModule () {
146144
147- }).newDigester ();
145+ @ Override
146+ protected void loadRules () {
147+ loadXMLRules (url );
148+ }
149+
150+ }).newDigester ();
151+ }
152+ };
153+ assertThrows (org .apache .commons .digester3 .binder .DigesterLoadingException .class , testMethod );
148154 }
149155
150156}
You can’t perform that action at this time.
0 commit comments