garydgregory commented on code in PR #43:
URL: https://github.com/apache/commons-digester/pull/43#discussion_r1038099558
##########
core/src/test/java/org/apache/commons/digester3/DTDValidationTestCase.java:
##########
@@ -29,50 +30,44 @@
/**
* Tests for entity resolution and dtd validation
*/
-public class DTDValidationTestCase
-{
+public class DTDValidationTestCase {
- @Test( expected = SAXParseException.class )
- public void testDigesterDTDError()
- throws Exception
- {
- newLoader( new AbstractRulesModule() {
-
- @Override
- protected void configure()
- {
- // do nothing
- }
-
- } )
- .setValidating( true )
- .setErrorHandler( new ErrorHandler()
- {
-
- @Override
- public void warning( final SAXParseException e )
- throws SAXException
- {
- throw e;
- }
-
- @Override
- public void fatalError( final SAXParseException e )
- throws SAXException
- {
- throw e;
- }
-
- @Override
- public void error( final SAXParseException e )
- throws SAXException
- {
- throw e;
- }
-
- } )
- .newDigester()
- .parse( new File(
"src/test/resources/org/apache/commons/digester3/document-with-relative-dtd-error.xml"
) );
+ @Test
+ public void testDigesterDTDError() {
+
+ assertThrows(SAXParseException.class, () ->
+ newLoader(new AbstractRulesModule() {
+
+ @Override
+ protected void configure() {
+ // do nothing
+ }
+
+ })
+ .setValidating(true)
Review Comment:
Fix weird formatting
##########
core/src/test/java/org/apache/commons/digester3/DTDValidationTestCase.java:
##########
@@ -29,50 +30,44 @@
/**
* Tests for entity resolution and dtd validation
*/
-public class DTDValidationTestCase
-{
+public class DTDValidationTestCase {
- @Test( expected = SAXParseException.class )
- public void testDigesterDTDError()
- throws Exception
- {
- newLoader( new AbstractRulesModule() {
-
- @Override
- protected void configure()
- {
- // do nothing
- }
-
- } )
- .setValidating( true )
- .setErrorHandler( new ErrorHandler()
- {
-
- @Override
- public void warning( final SAXParseException e )
- throws SAXException
- {
- throw e;
- }
-
- @Override
- public void fatalError( final SAXParseException e )
- throws SAXException
- {
- throw e;
- }
-
- @Override
- public void error( final SAXParseException e )
- throws SAXException
- {
- throw e;
- }
-
- } )
- .newDigester()
- .parse( new File(
"src/test/resources/org/apache/commons/digester3/document-with-relative-dtd-error.xml"
) );
+ @Test
+ public void testDigesterDTDError() {
+
+ assertThrows(SAXParseException.class, () ->
+ newLoader(new AbstractRulesModule() {
+
+ @Override
+ protected void configure() {
+ // do nothing
+ }
+
+ })
+ .setValidating(true)
+ .setErrorHandler(new ErrorHandler() {
+
+ @Override
+ public void warning(final SAXParseException e)
+ throws SAXException {
Review Comment:
throws can be on the same line as method signature.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]