Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/authenticator/TestNonLoginAndBasicAuthenticator.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/authenticator/TestNonLoginAndBasicAuthenticator.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/authenticator/TestNonLoginAndBasicAuthenticator.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/authenticator/TestNonLoginAndBasicAuthenticator.java Mon Nov 13 12:00:30 2017 @@ -24,9 +24,7 @@ import java.util.Map; import javax.servlet.http.HttpServletResponse; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.Context; @@ -303,7 +301,7 @@ public class TestNonLoginAndBasicAuthent // slightly paranoid verification boolean sameCookies = originalCookies.equals(cookies); - assertTrue(!sameCookies); + Assert.assertTrue(!sameCookies); } /* @@ -365,11 +363,11 @@ public class TestNonLoginAndBasicAuthent respHeaders); if (expectedRC != HttpServletResponse.SC_OK) { - assertEquals(expectedRC, rc); - assertTrue(bc.getLength() > 0); + Assert.assertEquals(expectedRC, rc); + Assert.assertTrue(bc.getLength() > 0); } else { - assertEquals("OK", bc.toString()); + Assert.assertEquals("OK", bc.toString()); } } @@ -395,8 +393,8 @@ public class TestNonLoginAndBasicAuthent respHeaders); if (expectedRC != HttpServletResponse.SC_OK) { - assertEquals(expectedRC, rc); - assertTrue(bc.getLength() > 0); + Assert.assertEquals(expectedRC, rc); + Assert.assertTrue(bc.getLength() > 0); if (expectedRC == HttpServletResponse.SC_UNAUTHORIZED) { // The server should identify the acceptable method(s) boolean methodFound = false; @@ -407,11 +405,11 @@ public class TestNonLoginAndBasicAuthent break; } } - assertTrue(methodFound); + Assert.assertTrue(methodFound); } } else { - assertEquals("OK", bc.toString()); + Assert.assertEquals("OK", bc.toString()); List<String> newCookies = respHeaders.get(SERVER_COOKIE_HEADER); if (newCookies != null) { // harvest cookies whenever the server sends some new ones
Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/authenticator/TestSSOnonLoginAndBasicAuthenticator.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/authenticator/TestSSOnonLoginAndBasicAuthenticator.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/authenticator/TestSSOnonLoginAndBasicAuthenticator.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/authenticator/TestSSOnonLoginAndBasicAuthenticator.java Mon Nov 13 12:00:30 2017 @@ -24,11 +24,7 @@ import java.util.Map; import javax.servlet.http.HttpServletResponse; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.Context; @@ -269,7 +265,7 @@ public class TestSSOnonLoginAndBasicAuth // verify the sessionID was encoded in the absolute URL String firstEncodedURL = encodedURL; - assertTrue(firstEncodedURL.contains(ENCODE_SESSION_PARAM)); + Assert.assertTrue(firstEncodedURL.contains(ENCODE_SESSION_PARAM)); // access the protected resource with the encoded url (with session id) doTestBasic(firstEncodedURL + forwardParam, @@ -279,8 +275,8 @@ public class TestSSOnonLoginAndBasicAuth // verify the sessionID has not changed // verify the SSO sessionID was not encoded String secondEncodedURL = encodedURL; - assertEquals(firstEncodedURL, secondEncodedURL); - assertFalse(firstEncodedURL.contains(ENCODE_SSOSESSION_PARAM)); + Assert.assertEquals(firstEncodedURL, secondEncodedURL); + Assert.assertFalse(firstEncodedURL.contains(ENCODE_SSOSESSION_PARAM)); // extract the first container's session ID int ix = secondEncodedURL.indexOf(ENCODE_SESSION_PARAM); @@ -363,11 +359,11 @@ public class TestSSOnonLoginAndBasicAuth respHeaders); if (expectedRC != HttpServletResponse.SC_OK) { - assertEquals(expectedRC, rc); - assertTrue(bc.getLength() > 0); + Assert.assertEquals(expectedRC, rc); + Assert.assertTrue(bc.getLength() > 0); } else { - assertEquals("OK", bc.toString()); + Assert.assertEquals("OK", bc.toString()); } } @@ -393,9 +389,9 @@ public class TestSSOnonLoginAndBasicAuth int rc = getUrl(HTTP_PREFIX + getPort() + uri, bc, reqHeaders, respHeaders); - assertEquals("Unexpected Return Code", expectedRC, rc); + Assert.assertEquals("Unexpected Return Code", expectedRC, rc); if (expectedRC != HttpServletResponse.SC_OK) { - assertTrue(bc.getLength() > 0); + Assert.assertTrue(bc.getLength() > 0); if (expectedRC == HttpServletResponse.SC_UNAUTHORIZED) { // The server should identify the acceptable method(s) boolean methodFound = false; @@ -406,13 +402,13 @@ public class TestSSOnonLoginAndBasicAuth break; } } - assertTrue(methodFound); + Assert.assertTrue(methodFound); } } else { String thePage = bc.toString(); - assertNotNull(thePage); - assertTrue(thePage.startsWith("OK")); + Assert.assertNotNull(thePage); + Assert.assertTrue(thePage.startsWith("OK")); if (useCookie) { List<String> newCookies = respHeaders.get(SERVER_COOKIE_HEADER); if (newCookies != null) { @@ -622,7 +618,7 @@ public class TestSSOnonLoginAndBasicAuth } sessions = manager.findSessions(); - assertTrue(sessions.length == 0); + Assert.assertTrue(sessions.length == 0); } /* Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/authenticator/TestSSOnonLoginAndDigestAuthenticator.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/authenticator/TestSSOnonLoginAndDigestAuthenticator.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/authenticator/TestSSOnonLoginAndDigestAuthenticator.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/authenticator/TestSSOnonLoginAndDigestAuthenticator.java Mon Nov 13 12:00:30 2017 @@ -21,9 +21,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.Context; @@ -215,12 +213,12 @@ public class TestSSOnonLoginAndDigestAut respHeaders); if (expectedReject) { - assertEquals(expectedRC, rc); - assertTrue(bc.getLength() > 0); + Assert.assertEquals(expectedRC, rc); + Assert.assertTrue(bc.getLength() > 0); } else { - assertEquals(200, rc); - assertEquals("OK", bc.toString()); + Assert.assertEquals(200, rc); + Assert.assertEquals("OK", bc.toString()); saveCookies(respHeaders); } } @@ -248,12 +246,12 @@ public class TestSSOnonLoginAndDigestAut respHeaders1); if (expectedReject1) { - assertEquals(expectedRC1, rc); - assertTrue(bc.getLength() > 0); + Assert.assertEquals(expectedRC1, rc); + Assert.assertTrue(bc.getLength() > 0); } else { - assertEquals(200, rc); - assertEquals("OK", bc.toString()); + Assert.assertEquals(200, rc); + Assert.assertEquals("OK", bc.toString()); saveCookies(respHeaders1); return; } @@ -289,12 +287,12 @@ public class TestSSOnonLoginAndDigestAut respHeaders2); if (req2expect200) { - assertEquals(200, rc); - assertEquals("OK", bc.toString()); + Assert.assertEquals(200, rc); + Assert.assertEquals("OK", bc.toString()); saveCookies(respHeaders2); } else { - assertEquals(401, rc); - assertTrue((bc.getLength() > 0)); + Assert.assertEquals(401, rc); + Assert.assertTrue((bc.getLength() > 0)); } } Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/authenticator/TesterDigestAuthenticatorPerformance.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/authenticator/TesterDigestAuthenticatorPerformance.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/authenticator/TesterDigestAuthenticatorPerformance.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/authenticator/TesterDigestAuthenticatorPerformance.java Mon Nov 13 12:00:30 2017 @@ -21,8 +21,7 @@ import java.util.concurrent.atomic.Atomi import javax.servlet.http.HttpServletResponse; -import static org.junit.Assert.assertEquals; - +import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -99,7 +98,7 @@ public class TesterDigestAuthenticatorPe System.out.println("Average time per request (wall): " + wallTime/(threadCount * requestCount)); - assertEquals(requestCount * threadCount, totalSuccess); + Assert.assertEquals(requestCount * threadCount, totalSuccess); } @Before Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/comet/TestCometProcessor.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/comet/TestCometProcessor.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/comet/TestCometProcessor.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/comet/TestCometProcessor.java Mon Nov 13 12:00:30 2017 @@ -28,10 +28,6 @@ import javax.servlet.http.HttpServletReq import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - import org.junit.Assert; import org.junit.Assume; import org.junit.Test; @@ -90,7 +86,7 @@ public class TestCometProcessor extends } if (count == 10) { - fail("Comet request did not complete"); + Assert.fail("Comet request did not complete"); } // Send a standard HTTP request on the same connection @@ -108,7 +104,7 @@ public class TestCometProcessor extends } if (count == 10) { - fail("Non-comet request did not complete"); + Assert.fail("Non-comet request did not complete"); } readThread.join(); @@ -160,7 +156,7 @@ public class TestCometProcessor extends Assert.assertTrue(readThread.getResponse().contains("2\r\nOK")); if (count == 10) { - fail("Comet request did not complete"); + Assert.fail("Comet request did not complete"); } // Send a standard HTTP request on the same connection @@ -179,7 +175,7 @@ public class TestCometProcessor extends } if (count == 10) { - fail("Non-comet request did not complete"); + Assert.fail("Non-comet request did not complete"); } readThread.join(); @@ -229,7 +225,7 @@ public class TestCometProcessor extends } if (count == 10) { - fail("Comet request did not complete"); + Assert.fail("Comet request did not complete"); } // Read thread should have terminated cleanly when the server closed the @@ -307,43 +303,43 @@ public class TestCometProcessor extends if (initParam == null) { // Normal response expected // Validate response - assertEquals("HTTP/1.1 200 OK", response[0]); - assertEquals("Server: Apache-Coyote/1.1", response[1]); - assertTrue(response[2].startsWith("Set-Cookie: JSESSIONID=")); - assertEquals("Content-Type: text/plain;charset=ISO-8859-1", response[3]); - assertEquals("Transfer-Encoding: chunked", response[4]); - assertTrue(response[5].startsWith("Date: ")); - assertEquals("", response[6]); - assertEquals("7", response[7]); - assertEquals("BEGIN", response[8]); - assertEquals("", response[9]); - assertEquals("17", response[10]); - assertEquals("Client: READ: 4 bytes", response[11]); - assertEquals("", response[12]); - assertEquals("17", response[13]); - assertEquals("Client: READ: 4 bytes", response[14]); - assertEquals("", response[15]); - assertEquals("17", response[16]); - assertEquals("Client: READ: 4 bytes", response[17]); - assertEquals("", response[18]); - assertEquals("17", response[19]); - assertEquals("Client: READ: 4 bytes", response[20]); - assertEquals("", response[21]); - assertEquals("d", response[22]); - assertEquals("Client: END", response[23]); - assertEquals("", response[24]); - assertEquals("0", response[25]); + Assert.assertEquals("HTTP/1.1 200 OK", response[0]); + Assert.assertEquals("Server: Apache-Coyote/1.1", response[1]); + Assert.assertTrue(response[2].startsWith("Set-Cookie: JSESSIONID=")); + Assert.assertEquals("Content-Type: text/plain;charset=ISO-8859-1", response[3]); + Assert.assertEquals("Transfer-Encoding: chunked", response[4]); + Assert.assertTrue(response[5].startsWith("Date: ")); + Assert.assertEquals("", response[6]); + Assert.assertEquals("7", response[7]); + Assert.assertEquals("BEGIN", response[8]); + Assert.assertEquals("", response[9]); + Assert.assertEquals("17", response[10]); + Assert.assertEquals("Client: READ: 4 bytes", response[11]); + Assert.assertEquals("", response[12]); + Assert.assertEquals("17", response[13]); + Assert.assertEquals("Client: READ: 4 bytes", response[14]); + Assert.assertEquals("", response[15]); + Assert.assertEquals("17", response[16]); + Assert.assertEquals("Client: READ: 4 bytes", response[17]); + Assert.assertEquals("", response[18]); + Assert.assertEquals("17", response[19]); + Assert.assertEquals("Client: READ: 4 bytes", response[20]); + Assert.assertEquals("", response[21]); + Assert.assertEquals("d", response[22]); + Assert.assertEquals("Client: END", response[23]); + Assert.assertEquals("", response[24]); + Assert.assertEquals("0", response[25]); // Expect 26 lines - assertEquals(26, response.length); + Assert.assertEquals(26, response.length); } else { // Failure expected only expected for the fail on begin // Failure at any later stage and the response headers (including // the 200 response code will already have been sent to the client if (SimpleCometServlet.FAIL_ON_BEGIN.equals(initParam)) { - assertEquals("500", getStatusCode(response[0])); + Assert.assertEquals("500", getStatusCode(response[0])); alv.validateAccessLog(1, 500, 0, 1000); } else { - assertEquals("HTTP/1.1 200 OK", response[0]); + Assert.assertEquals("HTTP/1.1 200 OK", response[0]); alv.validateAccessLog(1, 200, 0, 5000); } @@ -436,8 +432,8 @@ public class TestCometProcessor extends } else { log.info(status); } - assertTrue("Comet END event not received", servlet.getEndEventOccurred()); - assertTrue("Comet END event not last event received", + Assert.assertTrue("Comet END event not received", servlet.getEndEventOccurred()); + Assert.assertTrue("Comet END event not last event received", EventType.END.equals(servlet.getLastEvent())); } Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/connector/TestConnector.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/connector/TestConnector.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/connector/TestConnector.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/connector/TestConnector.java Mon Nov 13 12:00:30 2017 @@ -18,9 +18,7 @@ package org.apache.catalina.connector; import java.net.SocketTimeoutException; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.Context; @@ -52,8 +50,8 @@ public class TestConnector extends Tomca ByteChunk bc = new ByteChunk(); int rc = getUrl("http://localhost:" + getPort() + "/", bc, null, null); - assertEquals(200, rc); - assertEquals("OK", bc.toString()); + Assert.assertEquals(200, rc); + Assert.assertEquals("OK", bc.toString()); rc = -1; bc.recycle(); @@ -68,7 +66,7 @@ public class TestConnector extends Tomca // Make sure the test passes if we do rc = 503; } - assertEquals(503, rc); + Assert.assertEquals(503, rc); } @@ -89,7 +87,7 @@ public class TestConnector extends Tomca int localPort1 = connector1.getLocalPort(); int localPort2 = connector2.getLocalPort(); - assertTrue(localPort1 > 0); - assertTrue(localPort2 > 0); + Assert.assertTrue(localPort1 > 0); + Assert.assertTrue(localPort2 > 0); } } Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/connector/TestKeepAliveCount.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/connector/TestKeepAliveCount.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/connector/TestKeepAliveCount.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/connector/TestKeepAliveCount.java Mon Nov 13 12:00:30 2017 @@ -23,8 +23,7 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.Context; @@ -85,7 +84,7 @@ public class TestKeepAliveCount extends disconnect(); reset(); tomcat.stop(); - assertTrue(passed); + Assert.assertTrue(passed); } private void doHttp11Request() throws Exception { @@ -109,14 +108,14 @@ public class TestKeepAliveCount extends for (int i=0; i<5; i++) { processRequest(false); // blocks until response has been read - assertTrue(getResponseLine()!=null && getResponseLine().startsWith("HTTP/1.1 200 ")); + Assert.assertTrue(getResponseLine()!=null && getResponseLine().startsWith("HTTP/1.1 200 ")); } boolean passed = (this.readLine()==null); // Close the connection disconnect(); reset(); tomcat.stop(); - assertTrue(passed); + Assert.assertTrue(passed); } @Override Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/connector/TestOutputBuffer.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/connector/TestOutputBuffer.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/connector/TestOutputBuffer.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/connector/TestOutputBuffer.java Mon Nov 13 12:00:30 2017 @@ -25,7 +25,7 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import static org.junit.Assert.assertEquals; +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.Context; @@ -60,16 +60,16 @@ public class TestOutputBuffer extends To for (int i = 1; i <= WritingServlet.EXPECTED_CONTENT_LENGTH; i*=10) { int rc = getUrl("http://localhost:" + getPort() + "/servlet" + i, bc, null, null); - assertEquals(HttpServletResponse.SC_OK, rc); - assertEquals( + Assert.assertEquals(HttpServletResponse.SC_OK, rc); + Assert.assertEquals( WritingServlet.EXPECTED_CONTENT_LENGTH, bc.getLength()); bc.recycle(); rc = getUrl("http://localhost:" + getPort() + "/servlet" + i + "?useBuffer=y", bc, null, null); - assertEquals(HttpServletResponse.SC_OK, rc); - assertEquals( + Assert.assertEquals(HttpServletResponse.SC_OK, rc); + Assert.assertEquals( WritingServlet.EXPECTED_CONTENT_LENGTH, bc.getLength()); bc.recycle(); @@ -91,8 +91,8 @@ public class TestOutputBuffer extends To ByteChunk bc = new ByteChunk(); int rc = getUrl("http://localhost:" + getPort() + "/", bc, null, null); - assertEquals(HttpServletResponse.SC_OK, rc); - assertEquals("OK", bc.toString()); + Assert.assertEquals(HttpServletResponse.SC_OK, rc); + Assert.assertEquals("OK", bc.toString()); } private static class WritingServlet extends HttpServlet { Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/connector/TestRequest.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/connector/TestRequest.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/connector/TestRequest.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/connector/TestRequest.java Mon Nov 13 12:00:30 2017 @@ -35,11 +35,6 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - import org.junit.Assert; import org.junit.BeforeClass; import org.junit.Ignore; @@ -81,41 +76,41 @@ public class TestRequest extends TomcatB // Edge cases around zero client.doRequest(-1, false); // Unlimited - assertTrue(client.isResponse200()); - assertTrue(client.isResponseBodyOK()); + Assert.assertTrue(client.isResponse200()); + Assert.assertTrue(client.isResponseBodyOK()); client.reset(); client.doRequest(0, false); // 0 bytes - too small should fail - assertTrue(client.isResponse413()); + Assert.assertTrue(client.isResponse413()); client.reset(); client.doRequest(1, false); // 1 byte - too small should fail - assertTrue(client.isResponse413()); + Assert.assertTrue(client.isResponse413()); client.reset(); // Edge cases around actual content length client.reset(); client.doRequest(6, false); // Too small should fail - assertTrue(client.isResponse413()); + Assert.assertTrue(client.isResponse413()); client.reset(); client.doRequest(7, false); // Just enough should pass - assertTrue(client.isResponse200()); - assertTrue(client.isResponseBodyOK()); + Assert.assertTrue(client.isResponse200()); + Assert.assertTrue(client.isResponseBodyOK()); client.reset(); client.doRequest(8, false); // 1 extra - should pass - assertTrue(client.isResponse200()); - assertTrue(client.isResponseBodyOK()); + Assert.assertTrue(client.isResponse200()); + Assert.assertTrue(client.isResponseBodyOK()); // Much larger client.reset(); client.doRequest(8096, false); // Plenty of space - should pass - assertTrue(client.isResponse200()); - assertTrue(client.isResponseBodyOK()); + Assert.assertTrue(client.isResponse200()); + Assert.assertTrue(client.isResponseBodyOK()); // Check for case insensitivity client.reset(); client.doRequest(8096, true); // Plenty of space - should pass - assertTrue(client.isResponse200()); - assertTrue(client.isResponseBodyOK()); + Assert.assertTrue(client.isResponse200()); + Assert.assertTrue(client.isResponseBodyOK()); } /** @@ -130,8 +125,8 @@ public class TestRequest extends TomcatB client.reset(); client.doRequest(6, false); // Too small should fail // Response code will be OK, but parameters list will be empty - assertTrue(client.isResponse200()); - assertEquals("", client.getResponseBody()); + Assert.assertTrue(client.isResponse200()); + Assert.assertEquals("", client.getResponseBody()); } private static class Bug37794Servlet extends HttpServlet { @@ -283,15 +278,15 @@ public class TestRequest extends TomcatB // No query string ByteChunk res = getUrl("http://localhost:" + getPort() + "/"); - assertEquals("QueryString=null", res.toString()); + Assert.assertEquals("QueryString=null", res.toString()); // Query string res = getUrl("http://localhost:" + getPort() + "/?a=b"); - assertEquals("QueryString=a=b", res.toString()); + Assert.assertEquals("QueryString=a=b", res.toString()); // Empty string res = getUrl("http://localhost:" + getPort() + "/?"); - assertEquals("QueryString=", res.toString()); + Assert.assertEquals("QueryString=", res.toString()); } private static final class EchoQueryStringServlet extends HttpServlet { @@ -334,7 +329,7 @@ public class TestRequest extends TomcatB tomcat.start(); ByteChunk res = getUrl("http://localhost:" + getPort() + "/"); - assertEquals(LoginLogoutServlet.OK, res.toString()); + Assert.assertEquals(LoginLogoutServlet.OK, res.toString()); } private static final class LoginLogoutServlet extends HttpServlet { @@ -377,7 +372,7 @@ public class TestRequest extends TomcatB HttpURLConnection conn = getConnection("http://localhost:" + getPort() + "/"); InputStream is = conn.getInputStream(); - assertNotNull(is); + Assert.assertNotNull(is); } @Test @@ -392,7 +387,7 @@ public class TestRequest extends TomcatB HttpURLConnection conn = getConnection("http://localhost:" + getPort() + "/"); conn.setChunkedStreamingMode(8 * 1024); InputStream is = conn.getInputStream(); - assertNotNull(is); + Assert.assertNotNull(is); } /** @@ -408,9 +403,9 @@ public class TestRequest extends TomcatB // Make sure GET works properly client.doRequest("GET", "foo=bar", null, null, false); - assertTrue("Non-200 response for GET request", + Assert.assertTrue("Non-200 response for GET request", client.isResponse200()); - assertEquals("Incorrect response for GET request", + Assert.assertEquals("Incorrect response for GET request", "foo=bar", client.getResponseBody()); @@ -422,9 +417,9 @@ public class TestRequest extends TomcatB // POST with separate GET and POST parameters client.doRequest("POST", "foo=bar", "application/x-www-form-urlencoded", "bar=baz", true); - assertTrue("Non-200 response for POST request", + Assert.assertTrue("Non-200 response for POST request", client.isResponse200()); - assertEquals("Incorrect response for POST request", + Assert.assertEquals("Incorrect response for POST request", "bar=baz,foo=bar", client.getResponseBody()); @@ -433,9 +428,9 @@ public class TestRequest extends TomcatB // POST with overlapping GET and POST parameters client.doRequest("POST", "foo=bar&bar=foo", "application/x-www-form-urlencoded", "bar=baz&foo=baz", true); - assertTrue("Non-200 response for POST request", + Assert.assertTrue("Non-200 response for POST request", client.isResponse200()); - assertEquals("Incorrect response for POST request", + Assert.assertEquals("Incorrect response for POST request", "bar=baz,bar=foo,foo=bar,foo=baz", client.getResponseBody()); @@ -444,9 +439,9 @@ public class TestRequest extends TomcatB // PUT without POST-style parsing client.doRequest("PUT", "foo=bar&bar=foo", "application/x-www-form-urlencoded", "bar=baz&foo=baz", false); - assertTrue("Non-200 response for PUT/noparse request", + Assert.assertTrue("Non-200 response for PUT/noparse request", client.isResponse200()); - assertEquals("Incorrect response for PUT request", + Assert.assertEquals("Incorrect response for PUT request", "bar=foo,foo=bar", client.getResponseBody()); @@ -455,9 +450,9 @@ public class TestRequest extends TomcatB // PUT with POST-style parsing client.doRequest("PUT", "foo=bar&bar=foo", "application/x-www-form-urlencoded", "bar=baz&foo=baz", true); - assertTrue("Non-200 response for PUT request", + Assert.assertTrue("Non-200 response for PUT request", client.isResponse200()); - assertEquals("Incorrect response for PUT/parse request", + Assert.assertEquals("Incorrect response for PUT/parse request", "bar=baz,bar=foo,foo=bar,foo=baz", client.getResponseBody()); @@ -687,10 +682,10 @@ public class TestRequest extends TomcatB while ((line = reader.readLine()) != null) { response.add(line); } - assertTrue(response.contains("Part äö")); + Assert.assertTrue(response.contains("Part äö")); } } else { - fail("OK status was expected: " + status); + Assert.fail("OK status was expected: " + status); } } @@ -838,7 +833,7 @@ public class TestRequest extends TomcatB if (resultPath == null) { resultPath = ""; } - assertEquals(expected, resultPath); + Assert.assertEquals(expected, resultPath); } private class Bug56501Servlet extends HttpServlet { Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/connector/TestResponse.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/connector/TestResponse.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/connector/TestResponse.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/connector/TestResponse.java Mon Nov 13 12:00:30 2017 @@ -29,9 +29,6 @@ import javax.servlet.http.HttpServletReq import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - import org.junit.Assert; import org.junit.Test; @@ -72,7 +69,7 @@ public class TestResponse extends Tomcat values.get(0).startsWith("HTTP/1.1")) { continue; } - fail("Null header name detected for value " + values); + Assert.fail("Null header name detected for value " + values); } } @@ -83,7 +80,7 @@ public class TestResponse extends Tomcat count ++; } } - assertEquals(1, count); + Assert.assertEquals(1, count); } private static final class Bug49598Servlet extends HttpServlet { @@ -118,7 +115,7 @@ public class TestResponse extends Tomcat ByteChunk bc = getUrl("http://localhost:" + getPort() + "/"); - assertEquals("OK", bc.toString()); + Assert.assertEquals("OK", bc.toString()); } private static final class CharsetServlet extends HttpServlet { @@ -157,7 +154,7 @@ public class TestResponse extends Tomcat ByteChunk bc = getUrl("http://localhost:" + getPort() + "/"); - assertEquals("OK", bc.toString()); + Assert.assertEquals("OK", bc.toString()); } Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/connector/TestSendFile.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/connector/TestSendFile.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/connector/TestSendFile.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/connector/TestSendFile.java Mon Nov 13 12:00:30 2017 @@ -36,8 +36,6 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import static org.junit.Assert.assertEquals; - import org.junit.Assert; import org.junit.Test; @@ -78,10 +76,10 @@ public class TestSendFile extends Tomcat for (int i = 0; i < ITERATIONS; i++) { long start = System.currentTimeMillis(); int rc = getUrl("http://localhost:" + getPort() + "/servlet" + i, bc, null, respHeaders); - assertEquals(HttpServletResponse.SC_OK, rc); + Assert.assertEquals(HttpServletResponse.SC_OK, rc); System.out.println("Client received " + bc.getLength() + " bytes in " + (System.currentTimeMillis() - start) + " ms."); - assertEquals(EXPECTED_CONTENT_LENGTH * (i + 1), bc.getLength()); + Assert.assertEquals(EXPECTED_CONTENT_LENGTH * (i + 1), bc.getLength()); bc.recycle(); } Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestApplicationSessionCookieConfig.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestApplicationSessionCookieConfig.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestApplicationSessionCookieConfig.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestApplicationSessionCookieConfig.java Mon Nov 13 12:00:30 2017 @@ -17,8 +17,7 @@ package org.apache.catalina.core; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -38,7 +37,7 @@ public class TestApplicationSessionCooki public void testSetCommentInitPhase() { context.setState(LifecycleState.STARTING_PREP); applicationSessionCookieConfig.setComment("test"); - assertTrue(applicationSessionCookieConfig.getComment().equals("test")); + Assert.assertTrue(applicationSessionCookieConfig.getComment().equals("test")); } @Test(expected = IllegalStateException.class) @@ -51,7 +50,7 @@ public class TestApplicationSessionCooki public void testSetDomainInitPhase() { context.setState(LifecycleState.STARTING_PREP); applicationSessionCookieConfig.setDomain("test"); - assertTrue(applicationSessionCookieConfig.getDomain().equals("test")); + Assert.assertTrue(applicationSessionCookieConfig.getDomain().equals("test")); } @Test(expected = IllegalStateException.class) @@ -64,7 +63,7 @@ public class TestApplicationSessionCooki public void testSetHttpOnlyInitPhase() { context.setState(LifecycleState.STARTING_PREP); applicationSessionCookieConfig.setHttpOnly(true); - assertTrue(applicationSessionCookieConfig.isHttpOnly()); + Assert.assertTrue(applicationSessionCookieConfig.isHttpOnly()); } @Test(expected = IllegalStateException.class) @@ -77,7 +76,7 @@ public class TestApplicationSessionCooki public void testSetMaxAgeInitPhase() { context.setState(LifecycleState.STARTING_PREP); applicationSessionCookieConfig.setMaxAge(1); - assertTrue(applicationSessionCookieConfig.getMaxAge() == 1); + Assert.assertTrue(applicationSessionCookieConfig.getMaxAge() == 1); } @Test(expected = IllegalStateException.class) @@ -90,7 +89,7 @@ public class TestApplicationSessionCooki public void testSetNameInitPhase() { context.setState(LifecycleState.STARTING_PREP); applicationSessionCookieConfig.setName("test"); - assertTrue(applicationSessionCookieConfig.getName().equals("test")); + Assert.assertTrue(applicationSessionCookieConfig.getName().equals("test")); } @Test(expected = IllegalStateException.class) @@ -103,7 +102,7 @@ public class TestApplicationSessionCooki public void testSetPathInitPhase() { context.setState(LifecycleState.STARTING_PREP); applicationSessionCookieConfig.setPath("test"); - assertTrue(applicationSessionCookieConfig.getPath().equals("test")); + Assert.assertTrue(applicationSessionCookieConfig.getPath().equals("test")); } @Test(expected = IllegalStateException.class) @@ -116,7 +115,7 @@ public class TestApplicationSessionCooki public void testSetSecureInitPhase() { context.setState(LifecycleState.STARTING_PREP); applicationSessionCookieConfig.setSecure(true); - assertTrue(applicationSessionCookieConfig.isSecure()); + Assert.assertTrue(applicationSessionCookieConfig.isSecure()); } @Test(expected = IllegalStateException.class) Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestAsyncContextImpl.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestAsyncContextImpl.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestAsyncContextImpl.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestAsyncContextImpl.java Mon Nov 13 12:00:30 2017 @@ -45,10 +45,6 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -109,7 +105,7 @@ public class TestAsyncContextImpl extend // Call the servlet once ByteChunk bc = getUrl("http://localhost:" + getPort() + "/"); - assertEquals("OK", bc.toString()); + Assert.assertEquals("OK", bc.toString()); // Give the async thread a chance to finish (but not too long) int counter = 0; @@ -118,7 +114,7 @@ public class TestAsyncContextImpl extend counter++; } - assertEquals("1false2true3true4true5false", servlet.getResult()); + Assert.assertEquals("1false2true3true4true5false", servlet.getResult()); // Check the access log alv.validateAccessLog(1, 200, Bug49528Servlet.THREAD_SLEEP_TIME, @@ -146,7 +142,7 @@ public class TestAsyncContextImpl extend // Call the servlet once ByteChunk bc = getUrl("http://localhost:" + getPort() + "/"); - assertEquals("OK", bc.toString()); + Assert.assertEquals("OK", bc.toString()); // Give the async thread a chance to finish (but not too long) int counter = 0; @@ -155,7 +151,7 @@ public class TestAsyncContextImpl extend counter++; } - assertEquals("1false2true3true4true5false", servlet.getResult()); + Assert.assertEquals("1false2true3true4true5false", servlet.getResult()); // Check the access log alv.validateAccessLog(1, 200, Bug49567Servlet.THREAD_SLEEP_TIME, @@ -231,7 +227,7 @@ public class TestAsyncContextImpl extend Map<String,List<String>> headers = new HashMap<>(); getUrl("http://localhost:" + getPort() + "/", bc, headers); - assertEquals("OK", bc.toString()); + Assert.assertEquals("OK", bc.toString()); List<String> contentLength = headers.get("Content-Length"); Assert.assertNotNull(contentLength); Assert.assertEquals(1, contentLength.size()); @@ -533,7 +529,7 @@ public class TestAsyncContextImpl extend Thread.sleep(50); count ++; } - assertEquals(expectedTrack, getTrack()); + Assert.assertEquals(expectedTrack, getTrack()); // Check the access log if (completeOnTimeout == null || @@ -670,7 +666,7 @@ public class TestAsyncContextImpl extend Thread.sleep(50); count ++; } - assertEquals(expectedTrack, getTrack()); + Assert.assertEquals(expectedTrack, getTrack()); // Check the access log alv.validateAccessLog(1, 200, 0, REQUEST_TIME); @@ -1013,7 +1009,7 @@ public class TestAsyncContextImpl extend Thread.sleep(50); count ++; } - assertEquals(expectedTrack, getTrack()); + Assert.assertEquals(expectedTrack, getTrack()); // Check the access log alv.validateAccessLog(1, 500, 0, REQUEST_TIME); @@ -1067,7 +1063,7 @@ public class TestAsyncContextImpl extend Thread.sleep(50); count ++; } - assertEquals(expectedTrack, getTrack()); + Assert.assertEquals(expectedTrack, getTrack()); // Check the access log alv.validateAccessLog(1, 200, AsyncStartRunnable.THREAD_SLEEP_TIME, @@ -1129,12 +1125,12 @@ public class TestAsyncContextImpl extend Map<String,List<String>> headers = new LinkedHashMap<>(); ByteChunk bc = new ByteChunk(); int rc = getUrl("http://localhost:" + getPort() + "/", bc, headers); - assertEquals(200, rc); - assertEquals("OK", bc.toString()); + Assert.assertEquals(200, rc); + Assert.assertEquals("OK", bc.toString()); List<String> testHeader = headers.get("A"); - assertNotNull(testHeader); - assertEquals(1, testHeader.size()); - assertEquals("xyz",testHeader.get(0)); + Assert.assertNotNull(testHeader); + Assert.assertEquals(1, testHeader.size()); + Assert.assertEquals("xyz",testHeader.get(0)); // Check the access log alv.validateAccessLog(1, 200, Bug50753Servlet.THREAD_SLEEP_TIME, @@ -1195,7 +1191,7 @@ public class TestAsyncContextImpl extend int rc = getUrl(url.toString(), new ByteChunk(), null); - assertEquals(500, rc); + Assert.assertEquals(500, rc); // Without this test may complete before access log has a chance to log // the request @@ -1232,7 +1228,7 @@ public class TestAsyncContextImpl extend int rc = getUrl(url.toString(), new ByteChunk(), null); - assertEquals(HttpServletResponse.SC_BAD_REQUEST, rc); + Assert.assertEquals(HttpServletResponse.SC_BAD_REQUEST, rc); // Without this test may complete before access log has a chance to log // the request @@ -1322,7 +1318,7 @@ public class TestAsyncContextImpl extend ByteChunk res = new ByteChunk(); int rc = getUrl(url.toString(), res, null); - assertEquals(HttpServletResponse.SC_BAD_REQUEST, rc); + Assert.assertEquals(HttpServletResponse.SC_BAD_REQUEST, rc); // SRV 10.9.2 - Handling an error is entirely the application's // responsibility when an error occurs on an application thread. @@ -1330,11 +1326,11 @@ public class TestAsyncContextImpl extend // error page mechanism to kick in could be viewed as handling the error String responseBody = res.toString(); Assert.assertNotNull(responseBody); - assertTrue(responseBody.length() > 0); + Assert.assertTrue(responseBody.length() > 0); if (customError) { - assertTrue(responseBody, responseBody.contains(CustomErrorServlet.ERROR_MESSAGE)); + Assert.assertTrue(responseBody, responseBody.contains(CustomErrorServlet.ERROR_MESSAGE)); } else { - assertTrue(responseBody, responseBody.contains(AsyncErrorServlet.ERROR_MESSAGE)); + Assert.assertTrue(responseBody, responseBody.contains(AsyncErrorServlet.ERROR_MESSAGE)); } // Without this test may complete before access log has a chance to log @@ -1427,8 +1423,8 @@ public class TestAsyncContextImpl extend ByteChunk body = new ByteChunk(); int rc = getUrl(url.toString(), body, null); - assertEquals(HttpServletResponse.SC_OK, rc); - assertEquals("OK", body.toString()); + Assert.assertEquals(HttpServletResponse.SC_OK, rc); + Assert.assertEquals("OK", body.toString()); } private static class Bug53337ServletA extends HttpServlet { @@ -1506,9 +1502,9 @@ public class TestAsyncContextImpl extend ByteChunk body = new ByteChunk(); int rc = getUrl(url.toString(), body, null); - assertEquals(HttpServletResponse.SC_OK, rc); - assertEquals("OK", body.toString()); - assertTrue(servletA.isAsyncWhenExpected()); + Assert.assertEquals(HttpServletResponse.SC_OK, rc); + Assert.assertEquals("OK", body.toString()); + Assert.assertTrue(servletA.isAsyncWhenExpected()); } private static class Bug53843ServletA extends HttpServlet { @@ -1755,15 +1751,15 @@ public class TestAsyncContextImpl extend ioe.printStackTrace(); } - assertEquals(HttpServletResponse.SC_OK, rc); + Assert.assertEquals(HttpServletResponse.SC_OK, rc); body.recycle(); rc = getUrl("http://localhost:" + getPort() + "/bug54178ServletB", body, null); - assertEquals(HttpServletResponse.SC_OK, rc); - assertEquals("OK", body.toString()); + Assert.assertEquals(HttpServletResponse.SC_OK, rc); + Assert.assertEquals("OK", body.toString()); } private static class Bug54178ServletA extends HttpServlet { @@ -2193,7 +2189,7 @@ public class TestAsyncContextImpl extend getUrl("http://localhost:" + getPort()+ "/stage1"); - assertEquals("doGet-startAsync-doGet-startAsync-onStartAsync-NonAsyncServletGet-onComplete-", getTrack()); + Assert.assertEquals("doGet-startAsync-doGet-startAsync-onStartAsync-NonAsyncServletGet-onComplete-", getTrack()); // Check the access log alv.validateAccessLog(1, 200, 0, REQUEST_TIME); @@ -2474,8 +2470,8 @@ public class TestAsyncContextImpl extend } private void checkRequestResponse(AsyncEvent event) { - assertEquals(servletRequest, event.getSuppliedRequest()); - assertEquals(servletResponse, event.getSuppliedResponse()); + Assert.assertEquals(servletRequest, event.getSuppliedRequest()); + Assert.assertEquals(servletResponse, event.getSuppliedResponse()); } }; final Context context = new TesterContext(); @@ -2629,8 +2625,8 @@ public class TestAsyncContextImpl extend ByteChunk body = new ByteChunk(); int rc = getUrl("http://localhost:" + getPort() + EncodedDispatchServlet.ENCODED_URI, body, null); - assertEquals(HttpServletResponse.SC_OK, rc); - assertEquals("OK", body.toString()); + Assert.assertEquals(HttpServletResponse.SC_OK, rc); + Assert.assertEquals("OK", body.toString()); } Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestDefaultInstanceManager.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestDefaultInstanceManager.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestDefaultInstanceManager.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestDefaultInstanceManager.java Mon Nov 13 12:00:30 2017 @@ -21,8 +21,7 @@ import java.lang.reflect.InvocationTarge import javax.naming.NamingException; -import static org.junit.Assert.assertEquals; - +import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; @@ -71,7 +70,7 @@ public class TestDefaultInstanceManager // First JSP should be unloaded and replaced by third (second left // alone) so no change in overall count - assertEquals(count, instanceManager.getAnnotationCacheSize()); + Assert.assertEquals(count, instanceManager.getAnnotationCacheSize()); } private DefaultInstanceManager doClassUnloadingPrep() throws Exception { Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestNamingContextListener.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestNamingContextListener.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestNamingContextListener.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestNamingContextListener.java Mon Nov 13 12:00:30 2017 @@ -22,8 +22,7 @@ import javax.naming.NamingException; import javax.servlet.ServletContextEvent; import javax.servlet.ServletContextListener; -import static org.junit.Assert.assertEquals; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.Context; @@ -65,7 +64,7 @@ public class TestNamingContextListener e tomcat.start(); - assertEquals(LifecycleState.STARTED, ctx.getState()); + Assert.assertEquals(LifecycleState.STARTED, ctx.getState()); } public static final class Bug49132Listener implements ServletContextListener { @@ -118,7 +117,7 @@ public class TestNamingContextListener e tomcat.start(); - assertEquals(LifecycleState.STARTED, ctx.getState()); + Assert.assertEquals(LifecycleState.STARTED, ctx.getState()); } public static class Bug54096EnvA { Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestStandardContext.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestStandardContext.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestStandardContext.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestStandardContext.java Mon Nov 13 12:00:30 2017 @@ -45,12 +45,6 @@ import javax.servlet.http.HttpServletRes import org.hamcrest.CoreMatchers; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - import org.junit.Assert; import org.junit.Test; @@ -96,7 +90,7 @@ public class TestStandardContext extends File docBase = new File(tomcat.getHost().getAppBaseFile(), "ROOT"); if (!docBase.mkdirs() && !docBase.isDirectory()) { - fail("Unable to create docBase"); + Assert.fail("Unable to create docBase"); } Context root = tomcat.addContext("", "ROOT"); @@ -110,11 +104,11 @@ public class TestStandardContext extends client.connect(); client.processRequest(); - assertTrue(client.isResponse404()); + Assert.assertTrue(client.isResponse404()); // Context failed to start. This checks that automatic transition // from FAILED to STOPPED state was successful. - assertEquals(LifecycleState.STOPPED, root.getState()); + Assert.assertEquals(LifecycleState.STOPPED, root.getState()); // Prepare context for the second attempt // Configuration was cleared on stop() thanks to @@ -125,8 +119,8 @@ public class TestStandardContext extends // The same request is processed successfully client.connect(); client.processRequest(); - assertTrue(client.isResponse200()); - assertEquals(Bug46243Filter.class.getName() + Assert.assertTrue(client.isResponse200()); + Assert.assertEquals(Bug46243Filter.class.getName() + HelloWorldServlet.RESPONSE_TEXT, client.getResponseBody()); } @@ -206,21 +200,21 @@ public class TestStandardContext extends try { context.start(); - fail(); + Assert.fail(); } catch (LifecycleException ex) { // As expected } - assertEquals(LifecycleState.FAILED, context.getState()); + Assert.assertEquals(LifecycleState.FAILED, context.getState()); // The second attempt loader.setFail(false); context.start(); - assertEquals(LifecycleState.STARTED, context.getState()); + Assert.assertEquals(LifecycleState.STARTED, context.getState()); // Using a test from testBug49922() to check that the webapp is running ByteChunk result = getUrl("http://localhost:" + getPort() + "/bug49922/target"); - assertEquals("Target", result.toString()); + Assert.assertEquals("Target", result.toString()); } @Test @@ -242,21 +236,21 @@ public class TestStandardContext extends try { context.start(); - fail(); + Assert.fail(); } catch (LifecycleException ex) { // As expected } - assertEquals(LifecycleState.FAILED, context.getState()); + Assert.assertEquals(LifecycleState.FAILED, context.getState()); // The second attempt listener.setFail(false); context.start(); - assertEquals(LifecycleState.STARTED, context.getState()); + Assert.assertEquals(LifecycleState.STARTED, context.getState()); // Using a test from testBug49922() to check that the webapp is running ByteChunk result = getUrl("http://localhost:" + getPort() + "/bug49922/target"); - assertEquals("Target", result.toString()); + Assert.assertEquals("Target", result.toString()); } private static class FailingWebappLoader extends WebappLoader { @@ -300,39 +294,39 @@ public class TestStandardContext extends // Check filter and servlet aren't called int rc = getUrl("http://localhost:" + getPort() + "/test/bug49922/foo", result, null); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); - assertTrue(result.getLength() > 0); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertTrue(result.getLength() > 0); // Check extension mapping works result = getUrl("http://localhost:" + getPort() + "/test/foo.do"); - assertEquals("FilterServlet", result.toString()); + Assert.assertEquals("FilterServlet", result.toString()); // Check path mapping works result = getUrl("http://localhost:" + getPort() + "/test/bug49922/servlet"); - assertEquals("FilterServlet", result.toString()); + Assert.assertEquals("FilterServlet", result.toString()); // Check servlet name mapping works result = getUrl("http://localhost:" + getPort() + "/test/foo.od"); - assertEquals("FilterServlet", result.toString()); + Assert.assertEquals("FilterServlet", result.toString()); // Check filter is only called once result = getUrl("http://localhost:" + getPort() + "/test/bug49922/servlet/foo.do"); - assertEquals("FilterServlet", result.toString()); + Assert.assertEquals("FilterServlet", result.toString()); result = getUrl("http://localhost:" + getPort() + "/test/bug49922/servlet/foo.od"); - assertEquals("FilterServlet", result.toString()); + Assert.assertEquals("FilterServlet", result.toString()); // Check dispatcher mapping result = getUrl("http://localhost:" + getPort() + "/test/bug49922/target"); - assertEquals("Target", result.toString()); + Assert.assertEquals("Target", result.toString()); result = getUrl("http://localhost:" + getPort() + "/test/bug49922/forward"); - assertEquals("FilterTarget", result.toString()); + Assert.assertEquals("FilterTarget", result.toString()); result = getUrl("http://localhost:" + getPort() + "/test/bug49922/include"); - assertEquals("IncludeFilterTarget", result.toString()); + Assert.assertEquals("IncludeFilterTarget", result.toString()); } @@ -445,8 +439,8 @@ public class TestStandardContext extends bc, null); // Check for a 401 - assertNotSame("OK", bc.toString()); - assertEquals(401, rc); + Assert.assertNotSame("OK", bc.toString()); + Assert.assertEquals(401, rc); } public static final class Bug50015SCI @@ -581,8 +575,8 @@ public class TestStandardContext extends ctx.stop(); // Make sure that init() and destroy() were called correctly - assertTrue(sci.getServlet().isOk()); - assertTrue(loadOnStartUp == sci.getServlet().isInitCalled()); + Assert.assertTrue(sci.getServlet().isOk()); + Assert.assertTrue(loadOnStartUp == sci.getServlet().isInitCalled()); } public static final class Bug51376SCI @@ -672,14 +666,14 @@ public class TestStandardContext extends client.doRequest("/regular", false, false); // Servlet attempts to read parts which will trigger an ISE - assertTrue(client.isResponse500()); + Assert.assertTrue(client.isResponse500()); client.reset(); // Make sure regular multipart works properly client.doRequest("/multipart", false, true); // send multipart request - assertEquals("Regular multipart doesn't work", + Assert.assertEquals("Regular multipart doesn't work", "parts=1", client.getResponseBody()); @@ -690,7 +684,7 @@ public class TestStandardContext extends client.doRequest("/regular", false, true); // send multipart request // Servlet attempts to read parts which will trigger an ISE - assertTrue(client.isResponse500()); + Assert.assertTrue(client.isResponse500()); client.reset(); @@ -699,7 +693,7 @@ public class TestStandardContext extends // there is no @MultipartConfig client.doRequest("/regular", true, true); // send multipart request - assertEquals("Incorrect response for configured casual multipart request", + Assert.assertEquals("Incorrect response for configured casual multipart request", "parts=1", client.getResponseBody()); @@ -886,13 +880,13 @@ public class TestStandardContext extends // first we test the flag itself, which can be set on the Host and // Context - assertFalse(context.getComputedFailCtxIfServletStartFails()); + Assert.assertFalse(context.getComputedFailCtxIfServletStartFails()); StandardHost host = (StandardHost) tomcat.getHost(); host.setFailCtxIfServletStartFails(true); - assertTrue(context.getComputedFailCtxIfServletStartFails()); + Assert.assertTrue(context.getComputedFailCtxIfServletStartFails()); context.setFailCtxIfServletStartFails(Boolean.FALSE); - assertFalse("flag on Context should override Host config", + Assert.assertFalse("flag on Context should override Host config", context.getComputedFailCtxIfServletStartFails()); // second, we test the actual effect of the flag on the startup @@ -901,11 +895,11 @@ public class TestStandardContext extends servlet.setLoadOnStartup(1); tomcat.start(); - assertTrue("flag false should not fail deployment", context.getState() + Assert.assertTrue("flag false should not fail deployment", context.getState() .isAvailable()); tomcat.stop(); - assertFalse(context.getState().isAvailable()); + Assert.assertFalse(context.getState().isAvailable()); host.removeChild(context); context = (StandardContext) tomcat.addContext("", @@ -914,7 +908,7 @@ public class TestStandardContext extends new FailingStartupServlet()); servlet.setLoadOnStartup(1); tomcat.start(); - assertFalse("flag true should fail deployment", context.getState() + Assert.assertFalse("flag true should fail deployment", context.getState() .isAvailable()); } Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestStandardContextAliases.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestStandardContextAliases.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestStandardContextAliases.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestStandardContextAliases.java Mon Nov 13 12:00:30 2017 @@ -28,8 +28,7 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.Context; @@ -64,9 +63,9 @@ public class TestStandardContextAliases String result = res.toString(); - assertTrue(result.indexOf("00-PASS") > -1); - assertTrue(result.indexOf("01-PASS") > -1); - assertTrue(result.indexOf("02-PASS") > -1); + Assert.assertTrue(result.indexOf("00-PASS") > -1); + Assert.assertTrue(result.indexOf("01-PASS") > -1); + Assert.assertTrue(result.indexOf("02-PASS") > -1); } Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestStandardContextResources.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestStandardContextResources.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestStandardContextResources.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestStandardContextResources.java Mon Nov 13 12:00:30 2017 @@ -31,9 +31,7 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.Context; @@ -95,7 +93,7 @@ public class TestStandardContextResource } int index = orderedLibs.indexOf("resources.jar"); int index2 = orderedLibs.indexOf("resources2.jar"); - assertTrue(orderedLibs.toString(), index >= 0 && index2 >= 0 + Assert.assertTrue(orderedLibs.toString(), index >= 0 && index2 >= 0 && index < index2); } @@ -148,7 +146,7 @@ public class TestStandardContextResource "<p>resourceB.jsp in resources.jar</p>"); // Check ordering, for BZ 54391 - assertEquals(Arrays.asList("resources.jar", "resources2.jar"), ctx + Assert.assertEquals(Arrays.asList("resources.jar", "resources2.jar"), ctx .getServletContext().getAttribute(ServletContext.ORDERED_LIBS)); tomcat.getHost().removeChild(ctx); @@ -170,7 +168,7 @@ public class TestStandardContextResource "<p>resourceB.jsp in resources2.jar</p>"); // Check ordering, for BZ 54391 - assertEquals(Arrays.asList("resources2.jar", "resources.jar"), ctx + Assert.assertEquals(Arrays.asList("resources2.jar", "resources.jar"), ctx .getServletContext().getAttribute(ServletContext.ORDERED_LIBS)); } @@ -273,11 +271,11 @@ public class TestStandardContextResource ByteChunk res = new ByteChunk(); int sc = getUrl("http://localhost:" + getPort() + pageUrl, res, null); - assertEquals(expectedStatus, sc); + Assert.assertEquals(expectedStatus, sc); if (expectedStatus == 200) { String result = res.toString(); - assertTrue(result, result.indexOf(expectedBody) > 0); + Assert.assertTrue(result, result.indexOf(expectedBody) > 0); } } } Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestStandardContextValve.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestStandardContextValve.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestStandardContextValve.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestStandardContextValve.java Mon Nov 13 12:00:30 2017 @@ -25,7 +25,7 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import static org.junit.Assert.assertEquals; +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.Context; @@ -79,8 +79,8 @@ public class TestStandardContextValve ex i--; } - assertEquals(Response.SC_NOT_FOUND, rc); - assertEquals("InitErrorDestroy", trace.toString()); + Assert.assertEquals(Response.SC_NOT_FOUND, rc); + Assert.assertEquals("InitErrorDestroy", trace.toString()); } @Test @@ -129,8 +129,8 @@ public class TestStandardContextValve ex i--; } - assertEquals(Response.SC_NOT_FOUND, rc); - assertEquals("InitErrorDestroy", trace.toString()); + Assert.assertEquals(Response.SC_NOT_FOUND, rc); + Assert.assertEquals("InitErrorDestroy", trace.toString()); } private static class Bug51653ErrorTrigger extends HttpServlet { Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestStandardWrapper.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestStandardWrapper.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestStandardWrapper.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestStandardWrapper.java Mon Nov 13 12:00:30 2017 @@ -42,10 +42,7 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.Context; @@ -163,8 +160,8 @@ public class TestStandardWrapper extends "/testStandardWrapper/securityAnnotationsWebXmlPriority", bc, null, null); - assertTrue(bc.getLength() > 0); - assertEquals(403, rc); + Assert.assertTrue(bc.getLength() > 0); + Assert.assertEquals(403, rc); } @Test @@ -177,8 +174,8 @@ public class TestStandardWrapper extends "/test/testStandardWrapper/securityAnnotationsMetaDataPriority", bc, null, null); - assertEquals("OK", bc.toString()); - assertEquals(200, rc); + Assert.assertEquals("OK", bc.toString()); + Assert.assertEquals(200, rc); } @Test @@ -206,8 +203,8 @@ public class TestStandardWrapper extends rc = getUrl("http://localhost:" + getPort() + "/", bc, null, null); - assertTrue(bc.getLength() > 0); - assertEquals(403, rc); + Assert.assertTrue(bc.getLength() > 0); + Assert.assertEquals(403, rc); } @Test @@ -225,16 +222,16 @@ public class TestStandardWrapper extends rc = getUrl("http://localhost:" + getPort() + "/protected.jsp", bc, null, null); - assertTrue(bc.getLength() > 0); - assertEquals(403, rc); + Assert.assertTrue(bc.getLength() > 0); + Assert.assertEquals(403, rc); bc.recycle(); rc = getUrl("http://localhost:" + getPort() + "/unprotected.jsp", bc, null, null); - assertEquals(200, rc); - assertTrue(bc.toString().contains("00-OK")); + Assert.assertEquals(200, rc); + Assert.assertTrue(bc.toString().contains("00-OK")); } private void doTestSecurityAnnotationsAddServlet(boolean useCreateServlet) @@ -257,11 +254,11 @@ public class TestStandardWrapper extends rc = getUrl("http://localhost:" + getPort() + "/", bc, null, null); if (useCreateServlet) { - assertTrue(bc.getLength() > 0); - assertEquals(403, rc); + Assert.assertTrue(bc.getLength() > 0); + Assert.assertEquals(403, rc); } else { - assertEquals("OK", bc.toString()); - assertEquals(200, rc); + Assert.assertEquals("OK", bc.toString()); + Assert.assertEquals(200, rc); } } @@ -313,11 +310,11 @@ public class TestStandardWrapper extends } if (expect200) { - assertEquals("OK", bc.toString()); - assertEquals(200, rc); + Assert.assertEquals("OK", bc.toString()); + Assert.assertEquals(200, rc); } else { - assertTrue(bc.getLength() > 0); - assertEquals(403, rc); + Assert.assertTrue(bc.getLength() > 0); + Assert.assertEquals(403, rc); } } @@ -452,9 +449,9 @@ public class TestStandardWrapper extends // Check the result for (int i = 0; i < BUG51445_THREAD_COUNT; i ++) { String[] results = threads[i].getResult().split(","); - assertEquals(2, results.length); - assertEquals("10", results[0]); - assertFalse(servlets.contains(results[1])); + Assert.assertEquals(2, results.length); + Assert.assertEquals("10", results[0]); + Assert.assertFalse(servlets.contains(results[1])); servlets.add(results[1]); } } @@ -497,9 +494,9 @@ public class TestStandardWrapper extends // Check the result for (int i = 0; i < BUG51445_THREAD_COUNT; i ++) { String[] results = threads[i].getResult().split(","); - assertEquals(2, results.length); - assertEquals("10", results[0]); - assertFalse(servlets.contains(results[1])); + Assert.assertEquals(2, results.length); + Assert.assertEquals("10", results[0]); + Assert.assertFalse(servlets.contains(results[1])); servlets.add(results[1]); } } Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestSwallowAbortedUploads.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestSwallowAbortedUploads.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestSwallowAbortedUploads.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/core/TestSwallowAbortedUploads.java Mon Nov 13 12:00:30 2017 @@ -35,9 +35,6 @@ import javax.servlet.http.HttpServletReq import javax.servlet.http.HttpServletResponse; import javax.servlet.http.Part; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - import org.junit.Assert; import org.junit.Test; @@ -94,9 +91,9 @@ public class TestSwallowAbortedUploads e log.info("Unlimited, swallow enabled"); AbortedUploadClient client = new AbortedUploadClient(); Exception ex = doAbortedUploadTest(client, false, true); - assertNull("Unlimited upload with swallow enabled generates client exception", + Assert.assertNull("Unlimited upload with swallow enabled generates client exception", ex); - assertTrue("Unlimited upload with swallow enabled returns error status code", + Assert.assertTrue("Unlimited upload with swallow enabled returns error status code", client.isResponse200()); client.reset(); } @@ -106,9 +103,9 @@ public class TestSwallowAbortedUploads e log.info("Unlimited, swallow disabled"); AbortedUploadClient client = new AbortedUploadClient(); Exception ex = doAbortedUploadTest(client, false, false); - assertNull("Unlimited upload with swallow disabled generates client exception", + Assert.assertNull("Unlimited upload with swallow disabled generates client exception", ex); - assertTrue("Unlimited upload with swallow disabled returns error status code", + Assert.assertTrue("Unlimited upload with swallow disabled returns error status code", client.isResponse200()); client.reset(); } @@ -118,9 +115,9 @@ public class TestSwallowAbortedUploads e log.info("Limited, swallow enabled"); AbortedUploadClient client = new AbortedUploadClient(); Exception ex = doAbortedUploadTest(client, true, true); - assertNull("Limited upload with swallow enabled generates client exception", + Assert.assertNull("Limited upload with swallow enabled generates client exception", ex); - assertTrue("Limited upload with swallow enabled returns non-500 status code", + Assert.assertTrue("Limited upload with swallow enabled returns non-500 status code", client.isResponse500()); client.reset(); } @@ -130,7 +127,7 @@ public class TestSwallowAbortedUploads e log.info("Limited, swallow disabled"); AbortedUploadClient client = new AbortedUploadClient(); Exception ex = doAbortedUploadTest(client, true, false); - assertTrue("Limited upload with swallow disabled does not generate client exception", + Assert.assertTrue("Limited upload with swallow disabled does not generate client exception", ex != null && ex instanceof java.net.SocketException); client.reset(); } @@ -140,9 +137,9 @@ public class TestSwallowAbortedUploads e log.info("Aborted (OK), swallow enabled"); AbortedPOSTClient client = new AbortedPOSTClient(); Exception ex = doAbortedPOSTTest(client, HttpServletResponse.SC_OK, true); - assertNull("Unlimited upload with swallow enabled generates client exception", + Assert.assertNull("Unlimited upload with swallow enabled generates client exception", ex); - assertTrue("Unlimited upload with swallow enabled returns error status code", + Assert.assertTrue("Unlimited upload with swallow enabled returns error status code", client.isResponse200()); client.reset(); } @@ -152,9 +149,9 @@ public class TestSwallowAbortedUploads e log.info("Aborted (OK), swallow disabled"); AbortedPOSTClient client = new AbortedPOSTClient(); Exception ex = doAbortedPOSTTest(client, HttpServletResponse.SC_OK, false); - assertNull("Unlimited upload with swallow disabled generates client exception", + Assert.assertNull("Unlimited upload with swallow disabled generates client exception", ex); - assertTrue("Unlimited upload with swallow disabled returns error status code", + Assert.assertTrue("Unlimited upload with swallow disabled returns error status code", client.isResponse200()); client.reset(); } @@ -164,9 +161,9 @@ public class TestSwallowAbortedUploads e log.info("Aborted (413), swallow enabled"); AbortedPOSTClient client = new AbortedPOSTClient(); Exception ex = doAbortedPOSTTest(client, HttpServletResponse.SC_REQUEST_ENTITY_TOO_LARGE, true); - assertNull("Limited upload with swallow enabled generates client exception", + Assert.assertNull("Limited upload with swallow enabled generates client exception", ex); - assertTrue("Limited upload with swallow enabled returns error status code", + Assert.assertTrue("Limited upload with swallow enabled returns error status code", client.isResponse413()); client.reset(); } @@ -176,7 +173,7 @@ public class TestSwallowAbortedUploads e log.info("Aborted (413), swallow disabled"); AbortedPOSTClient client = new AbortedPOSTClient(); Exception ex = doAbortedPOSTTest(client, HttpServletResponse.SC_REQUEST_ENTITY_TOO_LARGE, false); - assertTrue("Limited upload with swallow disabled does not generate client exception", + Assert.assertTrue("Limited upload with swallow disabled does not generate client exception", ex != null && ex instanceof java.net.SocketException); client.reset(); } Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/filters/TestAddCharSetFilter.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/filters/TestAddCharSetFilter.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/filters/TestAddCharSetFilter.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/filters/TestAddCharSetFilter.java Mon Nov 13 12:00:30 2017 @@ -28,8 +28,7 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import static org.junit.Assert.assertEquals; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.Context; @@ -118,9 +117,9 @@ public class TestAddCharSetFilter extend getUrl("http://localhost:" + getPort() + "/", new ByteChunk(), headers); List<String> ctHeaders = headers.get("Content-Type"); - assertEquals(1, ctHeaders.size()); + Assert.assertEquals(1, ctHeaders.size()); String ct = ctHeaders.get(0); - assertEquals("text/plain;charset=" + expected, ct); + Assert.assertEquals("text/plain;charset=" + expected, ct); } private static class CharsetServlet extends HttpServlet { Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/filters/TestCsrfPreventionFilter.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/filters/TestCsrfPreventionFilter.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/filters/TestCsrfPreventionFilter.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/filters/TestCsrfPreventionFilter.java Mon Nov 13 12:00:30 2017 @@ -24,10 +24,7 @@ import java.io.ObjectOutputStream; import javax.servlet.http.HttpServletResponse; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.filters.CsrfPreventionFilter.LruCache; @@ -44,25 +41,25 @@ public class TestCsrfPreventionFilter ex @Test public void testAddNonceNoQueryNoAnchor() throws Exception { - assertEquals("/test?" + RESULT_NONCE , + Assert.assertEquals("/test?" + RESULT_NONCE , wrapper.encodeRedirectURL("/test")); } @Test public void testAddNonceQueryNoAnchor() throws Exception { - assertEquals("/test?a=b&" + RESULT_NONCE , + Assert.assertEquals("/test?a=b&" + RESULT_NONCE , wrapper.encodeRedirectURL("/test?a=b")); } @Test public void testAddNonceNoQueryAnchor() throws Exception { - assertEquals("/test?" + RESULT_NONCE + "#c", + Assert.assertEquals("/test?" + RESULT_NONCE + "#c", wrapper.encodeRedirectURL("/test#c")); } @Test public void testAddNonceQueryAnchor() throws Exception { - assertEquals("/test?a=b&" + RESULT_NONCE + "#c", + Assert.assertEquals("/test?a=b&" + RESULT_NONCE + "#c", wrapper.encodeRedirectURL("/test?a=b#c")); } @@ -87,13 +84,13 @@ public class TestCsrfPreventionFilter ex LruCache<String> cache2 = (LruCache<String>) ois.readObject(); cache2.add("key7"); - assertFalse(cache2.contains("key1")); - assertFalse(cache2.contains("key2")); - assertTrue(cache2.contains("key3")); - assertTrue(cache2.contains("key4")); - assertTrue(cache2.contains("key5")); - assertTrue(cache2.contains("key6")); - assertTrue(cache2.contains("key7")); + Assert.assertFalse(cache2.contains("key1")); + Assert.assertFalse(cache2.contains("key2")); + Assert.assertTrue(cache2.contains("key3")); + Assert.assertTrue(cache2.contains("key4")); + Assert.assertTrue(cache2.contains("key5")); + Assert.assertTrue(cache2.contains("key6")); + Assert.assertTrue(cache2.contains("key7")); } @Test Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/filters/TestCsrfPreventionFilter2.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/filters/TestCsrfPreventionFilter2.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/filters/TestCsrfPreventionFilter2.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/filters/TestCsrfPreventionFilter2.java Mon Nov 13 12:00:30 2017 @@ -17,8 +17,7 @@ package org.apache.catalina.filters; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.filters.CsrfPreventionFilter.LruCache; @@ -34,7 +33,7 @@ public class TestCsrfPreventionFilter2 { int threadCount = 2; long iterationCount = 100000L; - assertTrue(threadCount > 1); + Assert.assertTrue(threadCount > 1); LruCache<String> cache = new LruCache<>(threadCount - 1); @@ -52,7 +51,7 @@ public class TestCsrfPreventionFilter2 { } for (int i = 0; i < threadCount; i++) { - assertTrue(threads[i].getResult()); + Assert.assertTrue(threads[i].getResult()); } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org