|
23 | 23 | import static org.junit.Assert.assertEquals; |
24 | 24 | import static org.junit.Assert.assertFalse; |
25 | 25 | import static org.junit.Assert.assertTrue; |
| 26 | +import static org.junit.jupiter.api.Assertions.assertThrows; |
26 | 27 |
|
27 | 28 | import org.apache.commons.digester3.annotations.FromAnnotationsRuleModule; |
28 | 29 | import org.apache.commons.digester3.binder.AbstractRulesModule; |
29 | 30 | import org.apache.commons.digester3.binder.RulesModule; |
30 | 31 | import org.apache.commons.digester3.xmlrules.FromXmlRulesModule; |
31 | 32 | import org.junit.Test; |
| 33 | +import org.junit.jupiter.api.function.Executable; |
32 | 34 | import org.xml.sax.SAXParseException; |
33 | 35 |
|
34 | 36 | /** |
@@ -170,17 +172,22 @@ public void basicConstructorWithValuesNotFound() |
170 | 172 | assertEquals( 0D, bean.getDoubleProperty(), 0 ); |
171 | 173 | } |
172 | 174 |
|
173 | | - @Test( expected = SAXParseException.class ) |
174 | | - public void basicConstructorWithWrongParameters() |
175 | | - throws Exception |
176 | | - { |
| 175 | + @Test |
| 176 | + public void basicConstructorWithWrongParameters() { |
177 | 177 | final ObjectCreateRule createRule = new ObjectCreateRule( TestBean.class ); |
178 | 178 | createRule.setConstructorArgumentTypes( boolean.class ); |
179 | 179 |
|
180 | 180 | final Digester digester = new Digester(); |
181 | 181 | digester.addRule( "toplevel/bean", createRule ); |
182 | 182 |
|
183 | | - digester.parse( getClass().getResourceAsStream( "BasicConstructor.xml" ) ); |
| 183 | + // FIXME Simplification once upgraded to Java 1.8 and use lambda |
| 184 | + final Executable testMethod = new Executable() { |
| 185 | + @Override |
| 186 | + public void execute() throws Throwable { |
| 187 | + digester.parse(getClass().getResourceAsStream("BasicConstructor.xml")); |
| 188 | + } |
| 189 | + }; |
| 190 | + assertThrows(SAXParseException.class, testMethod); |
184 | 191 | } |
185 | 192 |
|
186 | 193 | @Test |
|
0 commit comments