Author: markt Date: Thu Dec 4 20:55:04 2014 New Revision: 1643128 URL: http://svn.apache.org/viewvc?rev=1643128&view=rev Log: Refactor test to stop IDE complaining about possible NPEs. Also requires slightly less code.
Modified: tomcat/trunk/test/org/apache/catalina/valves/TestRequestFilterValve.java Modified: tomcat/trunk/test/org/apache/catalina/valves/TestRequestFilterValve.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/valves/TestRequestFilterValve.java?rev=1643128&r1=1643127&r2=1643128&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/valves/TestRequestFilterValve.java (original) +++ tomcat/trunk/test/org/apache/catalina/valves/TestRequestFilterValve.java Thu Dec 4 20:55:04 2014 @@ -24,6 +24,7 @@ import javax.servlet.ServletException; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.Context; @@ -97,9 +98,7 @@ public class TestRequestFilterValve { request.getMappingData().context = context; request.setCoyoteRequest(new org.apache.coyote.Request()); - if (type == null) { - fail("Invalid test with null type"); - } + Assert.assertNotNull("Invalid test with null type", type); if (property != null) { if (type.equals("Addr")) { valve = new RemoteAddrValve(); @@ -109,10 +108,9 @@ public class TestRequestFilterValve { valve = new RemoteHostValve(); request.setRemoteHost(property); msg.append(" host='" + property + "'"); - } else { - fail("Invalid test type" + type); } } + Assert.assertNotNull("Invalid test type" + type, valve); valve.setNext(new TerminatingValve()); if (allow != null) { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org