Skip to content

Commit

Permalink
JUnit assertThrows Digester153TestCase
Browse files Browse the repository at this point in the history
  • Loading branch information
nhojpatrick committed Nov 22, 2022
1 parent 3d4068d commit e3fa81f
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.jupiter.api.Assertions.assertThrows;

import org.apache.commons.digester3.annotations.FromAnnotationsRuleModule;
import org.apache.commons.digester3.binder.AbstractRulesModule;
Expand Down Expand Up @@ -170,17 +171,15 @@ public void basicConstructorWithValuesNotFound()
assertEquals( 0D, bean.getDoubleProperty(), 0 );
}

@Test( expected = SAXParseException.class )
public void basicConstructorWithWrongParameters()
throws Exception
{
@Test
public void basicConstructorWithWrongParameters() {
final ObjectCreateRule createRule = new ObjectCreateRule( TestBean.class );
createRule.setConstructorArgumentTypes( boolean.class );

final Digester digester = new Digester();
digester.addRule( "toplevel/bean", createRule );

digester.parse( getClass().getResourceAsStream( "BasicConstructor.xml" ) );
assertThrows(SAXParseException.class, () -> digester.parse(getClass().getResourceAsStream("BasicConstructor.xml")));
}

@Test
Expand Down

0 comments on commit e3fa81f

Please sign in to comment.