File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed
core/src/test/java/org/apache/commons/digester3/annotations/failingtests Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change 1818package org .apache .commons .digester3 .annotations .failingtests ;
1919
2020import static org .apache .commons .digester3 .binder .DigesterLoader .newLoader ;
21+ import static org .hamcrest .MatcherAssert .assertThat ;
22+ import static org .hamcrest .core .Is .is ;
23+ import static org .hamcrest .core .StringStartsWith .startsWith ;
24+ import static org .junit .jupiter .api .Assertions .assertThrows ;
2125
2226import org .apache .commons .digester3 .annotations .FromAnnotationsRuleModule ;
2327import org .apache .commons .digester3 .binder .DigesterLoadingException ;
@@ -29,20 +33,20 @@ public final class FailingTestCase
2933 /**
3034 * Tests to make sure loader fails
3135 */
32- @ Test ( expected = DigesterLoadingException . class )
36+ @ Test
3337 public void failsBecauseFailingDigesterLoaderHandlerFactory () {
3438
35- newLoader ( new FromAnnotationsRuleModule ()
36- {
39+ final DigesterLoadingException thrown = assertThrows ( DigesterLoadingException . class , () ->
40+ newLoader ( new FromAnnotationsRuleModule () {
3741
38- @ Override
39- protected void configureRules ()
40- {
41- useAnnotationHandlerFactory ( new FailingDigesterLoaderHandlerFactory () );
42- bindRulesFrom ( BeanWithFakeHandler .class );
43- }
42+ @ Override
43+ protected void configureRules () {
44+ useAnnotationHandlerFactory (new FailingDigesterLoaderHandlerFactory ());
45+ bindRulesFrom (BeanWithFakeHandler .class );
46+ }
4447
45- }).newDigester ();
48+ }).newDigester ());
49+ assertThat (thrown .getMessage (), is (startsWith ("Digester creation errors:" )));
4650 }
4751
4852}
You can’t perform that action at this time.
0 commit comments