Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/filters/TestRemoteIpFilter.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/filters/TestRemoteIpFilter.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/filters/TestRemoteIpFilter.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/filters/TestRemoteIpFilter.java Mon Nov 13 12:00:30 2017 @@ -37,10 +37,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.assertFalse; -import static org.junit.Assert.assertNull; - import org.junit.Assert; import org.junit.Test; @@ -163,20 +159,20 @@ public class TestRemoteIpFilter extends public void testCommaDelimitedListToStringArray() { List<String> elements = Arrays.asList("element1", "element2", "element3"); String actual = RemoteIpFilter.listToCommaDelimitedString(elements); - assertEquals("element1, element2, element3", actual); + Assert.assertEquals("element1, element2, element3", actual); } @Test public void testCommaDelimitedListToStringArrayEmptyList() { List<String> elements = new ArrayList<>(); String actual = RemoteIpFilter.listToCommaDelimitedString(elements); - assertEquals("", actual); + Assert.assertEquals("", actual); } @Test public void testCommaDelimitedListToStringArrayNullList() { String actual = RemoteIpFilter.listToCommaDelimitedString(null); - assertEquals("", actual); + Assert.assertEquals("", actual); } @Test @@ -185,8 +181,8 @@ public class TestRemoteIpFilter extends request.setHeader("myheader", "lower Case"); request.setHeader("MYHEADER", "UPPER CASE"); request.setHeader("MyHeader", "Camel Case"); - assertEquals(1, request.headers.size()); - assertEquals("Camel Case", request.getHeader("myheader")); + Assert.assertEquals(1, request.headers.size()); + Assert.assertEquals("Camel Case", request.getHeader("myheader")); } @Test @@ -209,19 +205,19 @@ public class TestRemoteIpFilter extends // VERIFY boolean actualSecure = actualRequest.isSecure(); - assertFalse("request must be unsecured as header x-forwarded-proto said it is http", actualSecure); + Assert.assertFalse("request must be unsecured as header x-forwarded-proto said it is http", actualSecure); String actualScheme = actualRequest.getScheme(); - assertEquals("scheme must be http as header x-forwarded-proto said it is http", "http", actualScheme); + Assert.assertEquals("scheme must be http as header x-forwarded-proto said it is http", "http", actualScheme); int actualServerPort = actualRequest.getServerPort(); - assertEquals("wrong http server port", 8080, actualServerPort); + Assert.assertEquals("wrong http server port", 8080, actualServerPort); String actualRemoteAddr = actualRequest.getRemoteAddr(); - assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); + Assert.assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); String actualRemoteHost = actualRequest.getRemoteHost(); - assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); + Assert.assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); } @Test @@ -242,16 +238,16 @@ public class TestRemoteIpFilter extends // VERIFY boolean actualSecure = actualRequest.isSecure(); - assertFalse("request must be unsecured as header x-forwarded-proto said it is http", actualSecure); + Assert.assertFalse("request must be unsecured as header x-forwarded-proto said it is http", actualSecure); String actualScheme = actualRequest.getScheme(); - assertEquals("scheme must be http as header x-forwarded-proto said it is http", "http", actualScheme); + Assert.assertEquals("scheme must be http as header x-forwarded-proto said it is http", "http", actualScheme); String actualRemoteAddr = actualRequest.getRemoteAddr(); - assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); + Assert.assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); String actualRemoteHost = actualRequest.getRemoteHost(); - assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); + Assert.assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); } @@ -273,16 +269,16 @@ public class TestRemoteIpFilter extends // VERIFY String actualXForwardedFor = request.getHeader("x-forwarded-for"); - assertNull("x-forwarded-for must be null", actualXForwardedFor); + Assert.assertNull("x-forwarded-for must be null", actualXForwardedFor); String actualXForwardedBy = request.getHeader("x-forwarded-by"); - assertNull("x-forwarded-by must be null", actualXForwardedBy); + Assert.assertNull("x-forwarded-by must be null", actualXForwardedBy); String actualRemoteAddr = actualRequest.getRemoteAddr(); - assertEquals("remoteAddr", "192.168.0.10", actualRemoteAddr); + Assert.assertEquals("remoteAddr", "192.168.0.10", actualRemoteAddr); String actualRemoteHost = actualRequest.getRemoteHost(); - assertEquals("remoteHost", "remote-host-original-value", actualRemoteHost); + Assert.assertEquals("remoteHost", "remote-host-original-value", actualRemoteHost); } @Test @@ -305,16 +301,16 @@ public class TestRemoteIpFilter extends // VERIFY String actualXForwardedFor = actualRequest.getHeader("x-forwarded-for"); - assertNull("all proxies are internal, x-forwarded-for must be null", actualXForwardedFor); + Assert.assertNull("all proxies are internal, x-forwarded-for must be null", actualXForwardedFor); String actualXForwardedBy = actualRequest.getHeader("x-forwarded-by"); - assertNull("all proxies are internal, x-forwarded-by must be null", actualXForwardedBy); + Assert.assertNull("all proxies are internal, x-forwarded-by must be null", actualXForwardedBy); String actualRemoteAddr = actualRequest.getRemoteAddr(); - assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); + Assert.assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); String actualRemoteHost = actualRequest.getRemoteHost(); - assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); + Assert.assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); } @Test @@ -340,16 +336,16 @@ public class TestRemoteIpFilter extends // VERIFY String actualXForwardedFor = actualRequest.getHeader("x-forwarded-for"); - assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor); + Assert.assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor); String actualXForwardedBy = actualRequest.getHeader("x-forwarded-by"); - assertEquals("all proxies are trusted, they must appear in x-forwarded-by", "proxy1, proxy2", actualXForwardedBy); + Assert.assertEquals("all proxies are trusted, they must appear in x-forwarded-by", "proxy1, proxy2", actualXForwardedBy); String actualRemoteAddr = actualRequest.getRemoteAddr(); - assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); + Assert.assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); String actualRemoteHost = actualRequest.getRemoteHost(); - assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); + Assert.assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); } @Test @@ -374,16 +370,16 @@ public class TestRemoteIpFilter extends // VERIFY String actualXForwardedFor = actualRequest.getHeader("x-forwarded-for"); - assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor); + Assert.assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor); String actualXForwardedBy = actualRequest.getHeader("x-forwarded-by"); - assertEquals("all proxies are trusted, they must appear in x-forwarded-by", "proxy1, proxy2", actualXForwardedBy); + Assert.assertEquals("all proxies are trusted, they must appear in x-forwarded-by", "proxy1, proxy2", actualXForwardedBy); String actualRemoteAddr = actualRequest.getRemoteAddr(); - assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); + Assert.assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); String actualRemoteHost = actualRequest.getRemoteHost(); - assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); + Assert.assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); } @Test @@ -407,16 +403,16 @@ public class TestRemoteIpFilter extends // VERIFY String actualXForwardedFor = actualRequest.getHeader("x-forwarded-for"); - assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor); + Assert.assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor); String actualXForwardedBy = actualRequest.getHeader("x-forwarded-by"); - assertEquals("all proxies are trusted, they must appear in x-forwarded-by", "proxy1, proxy2", actualXForwardedBy); + Assert.assertEquals("all proxies are trusted, they must appear in x-forwarded-by", "proxy1, proxy2", actualXForwardedBy); String actualRemoteAddr = actualRequest.getRemoteAddr(); - assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); + Assert.assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); String actualRemoteHost = actualRequest.getRemoteHost(); - assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); + Assert.assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); } @Test @@ -439,16 +435,16 @@ public class TestRemoteIpFilter extends // VERIFY String actualXForwardedFor = actualRequest.getHeader("x-forwarded-for"); - assertEquals("x-forwarded-for must be unchanged", "140.211.11.130, proxy1, proxy2", actualXForwardedFor); + Assert.assertEquals("x-forwarded-for must be unchanged", "140.211.11.130, proxy1, proxy2", actualXForwardedFor); String actualXForwardedBy = actualRequest.getHeader("x-forwarded-by"); - assertNull("x-forwarded-by must be null", actualXForwardedBy); + Assert.assertNull("x-forwarded-by must be null", actualXForwardedBy); String actualRemoteAddr = actualRequest.getRemoteAddr(); - assertEquals("remoteAddr", "not-allowed-internal-proxy", actualRemoteAddr); + Assert.assertEquals("remoteAddr", "not-allowed-internal-proxy", actualRemoteAddr); String actualRemoteHost = actualRequest.getRemoteHost(); - assertEquals("remoteHost", "not-allowed-internal-proxy-host", actualRemoteHost); + Assert.assertEquals("remoteHost", "not-allowed-internal-proxy-host", actualRemoteHost); } @Test @@ -471,25 +467,25 @@ public class TestRemoteIpFilter extends // VERIFY String actualXForwardedFor = actualRequest.getHeader("x-forwarded-for"); - assertEquals("ip/host before untrusted-proxy must appear in x-forwarded-for", "140.211.11.130, proxy1", actualXForwardedFor); + Assert.assertEquals("ip/host before untrusted-proxy must appear in x-forwarded-for", "140.211.11.130, proxy1", actualXForwardedFor); String actualXForwardedBy = actualRequest.getHeader("x-forwarded-by"); - assertEquals("ip/host after untrusted-proxy must appear in x-forwarded-by", "proxy2", actualXForwardedBy); + Assert.assertEquals("ip/host after untrusted-proxy must appear in x-forwarded-by", "proxy2", actualXForwardedBy); String actualRemoteAddr = actualRequest.getRemoteAddr(); - assertEquals("remoteAddr", "untrusted-proxy", actualRemoteAddr); + Assert.assertEquals("remoteAddr", "untrusted-proxy", actualRemoteAddr); String actualRemoteHost = actualRequest.getRemoteHost(); - assertEquals("remoteHost", "untrusted-proxy", actualRemoteHost); + Assert.assertEquals("remoteHost", "untrusted-proxy", actualRemoteHost); } @Test public void testListToCommaDelimitedString() { String[] actual = RemoteIpFilter.commaDelimitedListToStringArray("element1, element2, element3"); String[] expected = new String[] { "element1", "element2", "element3" }; - assertEquals(expected.length, actual.length); + Assert.assertEquals(expected.length, actual.length); for (int i = 0; i < actual.length; i++) { - assertEquals(expected[i], actual[i]); + Assert.assertEquals(expected[i], actual[i]); } } @@ -497,9 +493,9 @@ public class TestRemoteIpFilter extends public void testListToCommaDelimitedStringMixedSpaceChars() { String[] actual = RemoteIpFilter.commaDelimitedListToStringArray("element1 , element2,\t element3"); String[] expected = new String[] { "element1", "element2", "element3" }; - assertEquals(expected.length, actual.length); + Assert.assertEquals(expected.length, actual.length); for (int i = 0; i < actual.length; i++) { - assertEquals(expected[i], actual[i]); + Assert.assertEquals(expected[i], actual[i]); } }
Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/filters/TestRestCsrfPreventionFilter.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/filters/TestRestCsrfPreventionFilter.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/filters/TestRestCsrfPreventionFilter.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/filters/TestRestCsrfPreventionFilter.java Mon Nov 13 12:00:30 2017 @@ -25,9 +25,7 @@ import javax.servlet.ServletResponse; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -272,24 +270,24 @@ public class TestRestCsrfPreventionFilte } private void verifyContinueChain() { - assertTrue(filterChain.isVisited()); + Assert.assertTrue(filterChain.isVisited()); } private void verifyContinueChainNonceAvailable() { - assertTrue(NONCE.equals(response.getHeader(Constants.CSRF_REST_NONCE_HEADER_NAME))); + Assert.assertTrue(NONCE.equals(response.getHeader(Constants.CSRF_REST_NONCE_HEADER_NAME))); verifyContinueChain(); } private void verifyContinueChainNonceNotAvailable() { - assertNull(response.getHeader(Constants.CSRF_REST_NONCE_HEADER_NAME)); + Assert.assertNull(response.getHeader(Constants.CSRF_REST_NONCE_HEADER_NAME)); verifyContinueChain(); } private void verifyDenyResponse(int statusCode) { - assertTrue(Constants.CSRF_REST_NONCE_HEADER_REQUIRED_VALUE.equals(response + Assert.assertTrue(Constants.CSRF_REST_NONCE_HEADER_REQUIRED_VALUE.equals(response .getHeader(Constants.CSRF_REST_NONCE_HEADER_NAME))); - assertTrue(statusCode == response.getStatus()); - assertTrue(!filterChain.isVisited()); + Assert.assertTrue(statusCode == response.getStatus()); + Assert.assertTrue(!filterChain.isVisited()); } private static class TesterFilterChain implements FilterChain { Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/filters/TestRestCsrfPreventionFilter2.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/filters/TestRestCsrfPreventionFilter2.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/filters/TestRestCsrfPreventionFilter2.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/filters/TestRestCsrfPreventionFilter2.java Mon Nov 13 12:00:30 2017 @@ -29,11 +29,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.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.Context; @@ -222,21 +218,21 @@ public class TestRestCsrfPreventionFilte rc = postUrl(body, HTTP_PREFIX + getPort() + uri, bc, reqHeaders, respHeaders); } - assertEquals(expectedRC, rc); + Assert.assertEquals(expectedRC, rc); if (expectedRC == HttpServletResponse.SC_OK) { - assertEquals(expectedResponse, bc.toString()); + Assert.assertEquals(expectedResponse, bc.toString()); List<String> newCookies = respHeaders.get(SERVER_COOKIE_HEADER); saveCookies(newCookies); } if (!expectCsrfRH) { - assertNull(respHeaders.get(Constants.CSRF_REST_NONCE_HEADER_NAME)); + Assert.assertNull(respHeaders.get(Constants.CSRF_REST_NONCE_HEADER_NAME)); } else { List<String> respHeaderValue = respHeaders.get(Constants.CSRF_REST_NONCE_HEADER_NAME); - assertNotNull(respHeaderValue); + Assert.assertNotNull(respHeaderValue); if (expectedCsrfRHV != null) { - assertTrue(respHeaderValue.contains(expectedCsrfRHV)); + Assert.assertTrue(respHeaderValue.contains(expectedCsrfRHV)); } else { validNonce = respHeaderValue.get(0); } Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/loader/TestVirtualContext.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/loader/TestVirtualContext.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/loader/TestVirtualContext.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/loader/TestVirtualContext.java Mon Nov 13 12:00:30 2017 @@ -14,10 +14,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.apache.catalina.loader; - import java.io.File; import java.io.FileOutputStream; import java.io.IOException; @@ -25,9 +23,6 @@ import java.io.InputStream; import java.util.Arrays; import java.util.HashSet; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - import org.junit.Assert; import org.junit.Test; @@ -145,19 +140,19 @@ public class TestVirtualContext extends getUrl( "http://localhost:" + getPort() + "/test/classpathGetResources.jsp?path=rsrc/").toString(); - assertTrue( + Assert.assertTrue( allUrls, allUrls.indexOf("/test/webapp-virtual-webapp/src/main/webapp/WEB-INF/classes/rsrc") > 0); - assertTrue( + Assert.assertTrue( allUrls, allUrls.indexOf("/test/webapp-virtual-webapp/src/main/webapp2/WEB-INF/classes/rsrc") > 0); - assertTrue( + Assert.assertTrue( allUrls, allUrls.indexOf("/test/webapp-virtual-webapp/src/main/webapp/WEB-INF/lib/rsrc.jar!/rsrc") > 0); - assertTrue( + Assert.assertTrue( allUrls, allUrls.indexOf("/test/webapp-virtual-webapp/target/classes/rsrc") > 0); - assertTrue( + Assert.assertTrue( allUrls, allUrls.indexOf("/test/webapp-virtual-library/target/WEB-INF/classes/rsrc") > 0); @@ -170,7 +165,7 @@ public class TestVirtualContext extends getUrl( "http://localhost:" + getPort() + "/test/classpathGetResources.jsp?path=rsrc2/").toString(); - assertTrue( + Assert.assertTrue( allRsrsc2ClasspathUrls, allRsrsc2ClasspathUrls.indexOf("/test/webapp-virtual-webapp/src/main/webapp2/WEB-INF/classes/rsrc2") > 0); @@ -213,13 +208,13 @@ public class TestVirtualContext extends getUrl( "http://localhost:" + getPort() + "/test/contextGetResourcePaths.jsp?path=/rsrc/").toString(); - assertTrue( + Assert.assertTrue( allRsrcPaths, allRsrcPaths.indexOf("/rsrc/resourceF.properties") > 0); - assertTrue( + Assert.assertTrue( allRsrcPaths, allRsrcPaths.indexOf("/rsrc/resourceE.properties") > 0); - assertTrue( + Assert.assertTrue( allRsrcPaths, allRsrcPaths.indexOf("/rsrc/resourceH.properties") > 0); @@ -232,7 +227,7 @@ public class TestVirtualContext extends getUrl( "http://localhost:" + getPort() + "/test/contextGetResourcePaths.jsp?path=/rsrc2/").toString(); - assertTrue( + Assert.assertTrue( allRsrc2Paths, allRsrc2Paths.indexOf("/rsrc2/resourceJ.properties") > 0); @@ -329,11 +324,11 @@ public class TestVirtualContext extends int sc = getUrl("http://localhost:" + getPort() + pageUrl, res, 10000, null, 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/loader/TestVirtualWebappLoader.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/loader/TestVirtualWebappLoader.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/loader/TestVirtualWebappLoader.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/loader/TestVirtualWebappLoader.java Mon Nov 13 12:00:30 2017 @@ -18,10 +18,7 @@ package org.apache.catalina.loader; import java.io.File; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.WebResourceRoot; @@ -35,8 +32,8 @@ public class TestVirtualWebappLoader ext @Test public void testModified() throws Exception { WebappLoader loader = new WebappLoader(); - assertNull(loader.getClassLoader()); - assertFalse(loader.modified()); + Assert.assertNull(loader.getClassLoader()); + Assert.assertFalse(loader.modified()); } @Test @@ -63,16 +60,16 @@ public class TestVirtualWebappLoader ext loader.start(); String[] repos = loader.getLoaderRepositories(); - assertEquals(4,repos.length); + Assert.assertEquals(4,repos.length); loader.stop(); repos = loader.getLoaderRepositories(); - assertEquals(0, repos.length); + Assert.assertEquals(0, repos.length); // no leak loader.start(); repos = loader.getLoaderRepositories(); - assertEquals(4,repos.length); + Assert.assertEquals(4,repos.length); // clear loader ctx.setLoader(null); Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderMemoryLeak.java Mon Nov 13 12:00:30 2017 @@ -25,8 +25,7 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import static org.junit.Assert.fail; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.Context; @@ -64,7 +63,7 @@ public class TestWebappClassLoaderMemory TaskServlet.TIMER_THREAD_NAME.equals(thread.getName())) { thread.join(5000); if (thread.isAlive()) { - fail("Timer thread still running"); + Assert.fail("Timer thread still running"); } } } Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderWeaving.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderWeaving.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderWeaving.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/loader/TestWebappClassLoaderWeaving.java Mon Nov 13 12:00:30 2017 @@ -24,13 +24,9 @@ import java.lang.instrument.ClassFileTra import java.lang.reflect.Method; import java.security.ProtectionDomain; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.fail; - import org.junit.After; import org.junit.AfterClass; +import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -84,8 +80,8 @@ public class TestWebappClassLoaderWeavin this.tomcat.start(); ClassLoader loader = this.context.getLoader().getClassLoader(); - assertNotNull("The class loader should not be null.", loader); - assertSame("The class loader is not correct.", WebappClassLoader.class, loader.getClass()); + Assert.assertNotNull("The class loader should not be null.", loader); + Assert.assertSame("The class loader is not correct.", WebappClassLoader.class, loader.getClass()); this.loader = (WebappClassLoader) loader; @@ -111,10 +107,10 @@ public class TestWebappClassLoaderWeavin public void testNoWeaving() throws Exception { String result = invokeDoMethodOnClass(this.loader, "TesterNeverWeavedClass"); - assertEquals("The first result is not correct.", "This will never be weaved.", result); + Assert.assertEquals("The first result is not correct.", "This will never be weaved.", result); result = invokeDoMethodOnClass(this.loader, "TesterUnweavedClass"); - assertEquals("The second result is not correct.", "Hello, Unweaved World!", result); + Assert.assertEquals("The second result is not correct.", "Hello, Unweaved World!", result); } @@ -123,17 +119,17 @@ public class TestWebappClassLoaderWeavin try { this.loader.addTransformer(null); - fail("Expected exception IllegalArgumentException, got no exception."); + Assert.fail("Expected exception IllegalArgumentException, got no exception."); } catch (IllegalArgumentException ignore) { // good } // class loading should still work, no weaving String result = invokeDoMethodOnClass(this.loader, "TesterNeverWeavedClass"); - assertEquals("The first result is not correct.", "This will never be weaved.", result); + Assert.assertEquals("The first result is not correct.", "This will never be weaved.", result); result = invokeDoMethodOnClass(this.loader, "TesterUnweavedClass"); - assertEquals("The second result is not correct.", "Hello, Unweaved World!", result); + Assert.assertEquals("The second result is not correct.", "Hello, Unweaved World!", result); } @@ -143,10 +139,10 @@ public class TestWebappClassLoaderWeavin this.loader.addTransformer(new ReplacementTransformer(WEAVED_REPLACEMENT_1)); String result = invokeDoMethodOnClass(this.loader, "TesterNeverWeavedClass"); - assertEquals("The first result is not correct.", "This will never be weaved.", result); + Assert.assertEquals("The first result is not correct.", "This will never be weaved.", result); result = invokeDoMethodOnClass(this.loader, "TesterUnweavedClass"); - assertEquals("The second result is not correct.", "Hello, Weaver #1!", result); + Assert.assertEquals("The second result is not correct.", "Hello, Weaver #1!", result); } @@ -156,10 +152,10 @@ public class TestWebappClassLoaderWeavin this.loader.addTransformer(new ReplacementTransformer(WEAVED_REPLACEMENT_2)); String result = invokeDoMethodOnClass(this.loader, "TesterNeverWeavedClass"); - assertEquals("The first result is not correct.", "This will never be weaved.", result); + Assert.assertEquals("The first result is not correct.", "This will never be weaved.", result); result = invokeDoMethodOnClass(this.loader, "TesterUnweavedClass"); - assertEquals("The second result is not correct.", "Hello, Weaver #2!", result); + Assert.assertEquals("The second result is not correct.", "Hello, Weaver #2!", result); } @@ -170,10 +166,10 @@ public class TestWebappClassLoaderWeavin this.loader.addTransformer(new ReplacementTransformer(WEAVED_REPLACEMENT_2)); String result = invokeDoMethodOnClass(this.loader, "TesterNeverWeavedClass"); - assertEquals("The first result is not correct.", "This will never be weaved.", result); + Assert.assertEquals("The first result is not correct.", "This will never be weaved.", result); result = invokeDoMethodOnClass(this.loader, "TesterUnweavedClass"); - assertEquals("The second result is not correct.", "Hello, Weaver #2!", result); + Assert.assertEquals("The second result is not correct.", "Hello, Weaver #2!", result); } @@ -184,10 +180,10 @@ public class TestWebappClassLoaderWeavin this.loader.addTransformer(new ReplacementTransformer(WEAVED_REPLACEMENT_1)); String result = invokeDoMethodOnClass(this.loader, "TesterNeverWeavedClass"); - assertEquals("The first result is not correct.", "This will never be weaved.", result); + Assert.assertEquals("The first result is not correct.", "This will never be weaved.", result); result = invokeDoMethodOnClass(this.loader, "TesterUnweavedClass"); - assertEquals("The second result is not correct.", "Hello, Weaver #1!", result); + Assert.assertEquals("The second result is not correct.", "Hello, Weaver #1!", result); } @@ -199,10 +195,10 @@ public class TestWebappClassLoaderWeavin this.loader.removeTransformer(removed); String result = invokeDoMethodOnClass(this.loader, "TesterNeverWeavedClass"); - assertEquals("The first result is not correct.", "This will never be weaved.", result); + Assert.assertEquals("The first result is not correct.", "This will never be weaved.", result); result = invokeDoMethodOnClass(this.loader, "TesterUnweavedClass"); - assertEquals("The second result is not correct.", "Hello, Unweaved World!", result); + Assert.assertEquals("The second result is not correct.", "Hello, Unweaved World!", result); } @@ -216,10 +212,10 @@ public class TestWebappClassLoaderWeavin this.loader.removeTransformer(removed); String result = invokeDoMethodOnClass(this.loader, "TesterNeverWeavedClass"); - assertEquals("The first result is not correct.", "This will never be weaved.", result); + Assert.assertEquals("The first result is not correct.", "This will never be weaved.", result); result = invokeDoMethodOnClass(this.loader, "TesterUnweavedClass"); - assertEquals("The second result is not correct.", "Hello, Weaver #1!", result); + Assert.assertEquals("The second result is not correct.", "Hello, Weaver #1!", result); } @@ -233,10 +229,10 @@ public class TestWebappClassLoaderWeavin this.loader.removeTransformer(removed); String result = invokeDoMethodOnClass(this.loader, "TesterNeverWeavedClass"); - assertEquals("The first result is not correct.", "This will never be weaved.", result); + Assert.assertEquals("The first result is not correct.", "This will never be weaved.", result); result = invokeDoMethodOnClass(this.loader, "TesterUnweavedClass"); - assertEquals("The second result is not correct.", "Hello, Weaver #2!", result); + Assert.assertEquals("The second result is not correct.", "Hello, Weaver #2!", result); } @@ -248,42 +244,42 @@ public class TestWebappClassLoaderWeavin this.loader.addTransformer(new ReplacementTransformer(WEAVED_REPLACEMENT_2)); String result = invokeDoMethodOnClass(this.loader, "TesterNeverWeavedClass"); - assertEquals("The first result is not correct.", "This will never be weaved.", result); + Assert.assertEquals("The first result is not correct.", "This will never be weaved.", result); result = invokeDoMethodOnClass(this.loader, "TesterUnweavedClass"); - assertEquals("The second result is not correct.", "Hello, Weaver #2!", result); + Assert.assertEquals("The second result is not correct.", "Hello, Weaver #2!", result); WebappClassLoader copiedLoader = this.loader.copyWithoutTransformers(); result = invokeDoMethodOnClass(copiedLoader, "TesterNeverWeavedClass"); - assertEquals("The third result is not correct.", "This will never be weaved.", result); + Assert.assertEquals("The third result is not correct.", "This will never be weaved.", result); result = invokeDoMethodOnClass(copiedLoader, "TesterUnweavedClass"); - assertEquals("The fourth result is not correct.", "Hello, Unweaved World!", result); + Assert.assertEquals("The fourth result is not correct.", "Hello, Unweaved World!", result); - assertEquals("getClearReferencesHttpClientKeepAliveThread did not match.", + Assert.assertEquals("getClearReferencesHttpClientKeepAliveThread did not match.", Boolean.valueOf(this.loader.getClearReferencesHttpClientKeepAliveThread()), Boolean.valueOf(copiedLoader.getClearReferencesHttpClientKeepAliveThread())); - assertEquals("getClearReferencesLogFactoryRelease did not match.", + Assert.assertEquals("getClearReferencesLogFactoryRelease did not match.", Boolean.valueOf(this.loader.getClearReferencesLogFactoryRelease()), Boolean.valueOf(copiedLoader.getClearReferencesLogFactoryRelease())); - assertEquals("getClearReferencesStatic did not match.", + Assert.assertEquals("getClearReferencesStatic did not match.", Boolean.valueOf(this.loader.getClearReferencesStatic()), Boolean.valueOf(copiedLoader.getClearReferencesStatic())); - assertEquals("getClearReferencesStopThreads did not match.", + Assert.assertEquals("getClearReferencesStopThreads did not match.", Boolean.valueOf(this.loader.getClearReferencesStopThreads()), Boolean.valueOf(copiedLoader.getClearReferencesStopThreads())); - assertEquals("getClearReferencesStopTimerThreads did not match.", + Assert.assertEquals("getClearReferencesStopTimerThreads did not match.", Boolean.valueOf(this.loader.getClearReferencesStopTimerThreads()), Boolean.valueOf(copiedLoader.getClearReferencesStopTimerThreads())); - assertEquals("getContextName did not match.", this.loader.getContextName(), + Assert.assertEquals("getContextName did not match.", this.loader.getContextName(), copiedLoader.getContextName()); - assertEquals("getDelegate did not match.", + Assert.assertEquals("getDelegate did not match.", Boolean.valueOf(this.loader.getDelegate()), Boolean.valueOf(copiedLoader.getDelegate())); - assertEquals("getURLs did not match.", this.loader.getURLs().length, + Assert.assertEquals("getURLs did not match.", this.loader.getURLs().length, copiedLoader.getURLs().length); - assertSame("getParent did not match.", this.loader.getParent(), copiedLoader.getParent()); + Assert.assertSame("getParent did not match.", this.loader.getParent(), copiedLoader.getParent()); } @@ -306,7 +302,7 @@ public class TestWebappClassLoaderWeavin throws Exception { Class<?> c = loader.findClass("org.apache.catalina.loader." + className); - assertNotNull("The loaded class should not be null.", c); + Assert.assertNotNull("The loaded class should not be null.", c); Method m = c.getMethod("doMethod"); Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/mapper/TestMapper.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/mapper/TestMapper.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/mapper/TestMapper.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/mapper/TestMapper.java Mon Nov 13 12:00:30 2017 @@ -20,13 +20,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.concurrent.atomic.AtomicBoolean; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -154,14 +148,14 @@ public class TestMapper extends LoggingB // Check we have the right number // (added 16 including one host alias. Three duplicates do not increase the count.) - assertEquals(16, mapper.hosts.length); + Assert.assertEquals(16, mapper.hosts.length); // Make sure adding a duplicate *does not* overwrite final int iowPos = 3; - assertEquals("blah7", mapper.hosts[iowPos].object.getName()); + Assert.assertEquals("blah7", mapper.hosts[iowPos].object.getName()); final int qwigPos = 8; - assertEquals("blah14", mapper.hosts[qwigPos].object.getName()); + Assert.assertEquals("blah14", mapper.hosts[qwigPos].object.getName()); // Check for alphabetical order of host names String previous; @@ -169,69 +163,69 @@ public class TestMapper extends LoggingB for (int i = 1; i < mapper.hosts.length; i++) { previous = current; current = mapper.hosts[i].name; - assertTrue(previous.compareTo(current) < 0); + Assert.assertTrue(previous.compareTo(current) < 0); } // Check that host alias has the same data Mapper.MappedHost host = mapper.hosts[iowPos]; Mapper.MappedHost alias = mapper.hosts[iowPos + 1]; - assertEquals("iowejoiejfoiew", host.name); - assertEquals("iowejoiejfoiew_alias", alias.name); - assertFalse(host.isAlias()); - assertTrue(alias.isAlias()); - assertEquals(host.object, alias.object); + Assert.assertEquals("iowejoiejfoiew", host.name); + Assert.assertEquals("iowejoiejfoiew_alias", alias.name); + Assert.assertFalse(host.isAlias()); + Assert.assertTrue(alias.isAlias()); + Assert.assertEquals(host.object, alias.object); // Test addContextVersion() followed by addHost() Host hostZ = createHost("zzzz"); Context contextZ = createContext("contextZ"); - assertEquals(16, mapper.hosts.length); + Assert.assertEquals(16, mapper.hosts.length); mapper.addContextVersion("zzzz", hostZ, "/", "", contextZ, null, null, null); - assertEquals(17, mapper.hosts.length); + Assert.assertEquals(17, mapper.hosts.length); mapper.addHost("zzzz", new String[] { "zzzz_alias1", "zzzz_alias2" }, hostZ); - assertEquals(19, mapper.hosts.length); + Assert.assertEquals(19, mapper.hosts.length); - assertEquals("zzzz", mapper.hosts[16].name); - assertEquals("zzzz_alias1", mapper.hosts[17].name); - assertEquals("zzzz_alias2", mapper.hosts[18].name); - assertEquals(2, mapper.hosts[16].getAliases().size()); - assertSame(contextZ, + Assert.assertEquals("zzzz", mapper.hosts[16].name); + Assert.assertEquals("zzzz_alias1", mapper.hosts[17].name); + Assert.assertEquals("zzzz_alias2", mapper.hosts[18].name); + Assert.assertEquals(2, mapper.hosts[16].getAliases().size()); + Assert.assertSame(contextZ, mapper.hosts[16].contextList.contexts[0].versions[0].object); - assertSame(contextZ, + Assert.assertSame(contextZ, mapper.hosts[18].contextList.contexts[0].versions[0].object); } @Test public void testRemoveHost() { - assertEquals(16, mapper.hosts.length); + Assert.assertEquals(16, mapper.hosts.length); mapper.removeHostAlias("iowejoiejfoiew"); mapper.removeHost("iowejoiejfoiew_alias"); - assertEquals(16, mapper.hosts.length); // No change + Assert.assertEquals(16, mapper.hosts.length); // No change mapper.removeHostAlias("iowejoiejfoiew_alias"); - assertEquals(15, mapper.hosts.length); // Removed + Assert.assertEquals(15, mapper.hosts.length); // Removed mapper.addHostAlias("iowejoiejfoiew", "iowejoiejfoiew_alias"); - assertEquals(16, mapper.hosts.length); + Assert.assertEquals(16, mapper.hosts.length); final int iowPos = 3; Mapper.MappedHost hostMapping = mapper.hosts[iowPos]; Mapper.MappedHost aliasMapping = mapper.hosts[iowPos + 1]; - assertEquals("iowejoiejfoiew_alias", aliasMapping.name); - assertTrue(aliasMapping.isAlias()); - assertSame(hostMapping.object, aliasMapping.object); - - assertEquals("iowejoiejfoiew", hostMapping.getRealHostName()); - assertEquals("iowejoiejfoiew", aliasMapping.getRealHostName()); - assertSame(hostMapping, hostMapping.getRealHost()); - assertSame(hostMapping, aliasMapping.getRealHost()); + Assert.assertEquals("iowejoiejfoiew_alias", aliasMapping.name); + Assert.assertTrue(aliasMapping.isAlias()); + Assert.assertSame(hostMapping.object, aliasMapping.object); + + Assert.assertEquals("iowejoiejfoiew", hostMapping.getRealHostName()); + Assert.assertEquals("iowejoiejfoiew", aliasMapping.getRealHostName()); + Assert.assertSame(hostMapping, hostMapping.getRealHost()); + Assert.assertSame(hostMapping, aliasMapping.getRealHost()); mapper.removeHost("iowejoiejfoiew"); - assertEquals(14, mapper.hosts.length); // Both host and alias removed + Assert.assertEquals(14, mapper.hosts.length); // Both host and alias removed for (Mapper.MappedHost host : mapper.hosts) { - assertTrue(host.name, !host.name.startsWith("iowejoiejfoiew")); + Assert.assertTrue(host.name, !host.name.startsWith("iowejoiejfoiew")); } } @@ -248,13 +242,13 @@ public class TestMapper extends LoggingB uri.getCharChunk().setLimit(-1); mapper.map(host, uri, null, mappingData); - assertEquals("blah7", mappingData.host.getName()); - assertEquals("context2", mappingData.context.getName()); - assertEquals("wrapper5", mappingData.wrapper.getName()); - assertEquals("/foo/bar", mappingData.contextPath.toString()); - assertEquals("/blah/bobou", mappingData.wrapperPath.toString()); - assertEquals("/foo", mappingData.pathInfo.toString()); - assertTrue(mappingData.redirectPath.isNull()); + Assert.assertEquals("blah7", mappingData.host.getName()); + Assert.assertEquals("context2", mappingData.context.getName()); + Assert.assertEquals("wrapper5", mappingData.wrapper.getName()); + Assert.assertEquals("/foo/bar", mappingData.contextPath.toString()); + Assert.assertEquals("/blah/bobou", mappingData.wrapperPath.toString()); + Assert.assertEquals("/foo", mappingData.pathInfo.toString()); + Assert.assertTrue(mappingData.redirectPath.isNull()); mappingData.recycle(); uri.recycle(); @@ -262,26 +256,26 @@ public class TestMapper extends LoggingB uri.toChars(); uri.getCharChunk().setLimit(-1); mapper.map(host, uri, null, mappingData); - assertEquals("blah7", mappingData.host.getName()); - assertEquals("context3", mappingData.context.getName()); - assertEquals("wrapper7", mappingData.wrapper.getName()); - assertEquals("/foo/bar/bla", mappingData.contextPath.toString()); - assertEquals("/bobou", mappingData.wrapperPath.toString()); - assertEquals("/foo", mappingData.pathInfo.toString()); - assertTrue(mappingData.redirectPath.isNull()); + Assert.assertEquals("blah7", mappingData.host.getName()); + Assert.assertEquals("context3", mappingData.context.getName()); + Assert.assertEquals("wrapper7", mappingData.wrapper.getName()); + Assert.assertEquals("/foo/bar/bla", mappingData.contextPath.toString()); + Assert.assertEquals("/bobou", mappingData.wrapperPath.toString()); + Assert.assertEquals("/foo", mappingData.pathInfo.toString()); + Assert.assertTrue(mappingData.redirectPath.isNull()); mappingData.recycle(); uri.setString("/foo/bar/bla/bobou/foo"); uri.toChars(); uri.getCharChunk().setLimit(-1); mapper.map(alias, uri, null, mappingData); - assertEquals("blah7", mappingData.host.getName()); - assertEquals("context3", mappingData.context.getName()); - assertEquals("wrapper7", mappingData.wrapper.getName()); - assertEquals("/foo/bar/bla", mappingData.contextPath.toString()); - assertEquals("/bobou", mappingData.wrapperPath.toString()); - assertEquals("/foo", mappingData.pathInfo.toString()); - assertTrue(mappingData.redirectPath.isNull()); + Assert.assertEquals("blah7", mappingData.host.getName()); + Assert.assertEquals("context3", mappingData.context.getName()); + Assert.assertEquals("wrapper7", mappingData.wrapper.getName()); + Assert.assertEquals("/foo/bar/bla", mappingData.contextPath.toString()); + Assert.assertEquals("/bobou", mappingData.wrapperPath.toString()); + Assert.assertEquals("/foo", mappingData.pathInfo.toString()); + Assert.assertTrue(mappingData.redirectPath.isNull()); } @Test @@ -299,26 +293,26 @@ public class TestMapper extends LoggingB // Verifying configuration created by setUp() Mapper.MappedHost mappedHost = mapper.hosts[iowPos]; - assertEquals(hostName, mappedHost.name); + Assert.assertEquals(hostName, mappedHost.name); Mapper.MappedContext mappedContext = mappedHost.contextList.contexts[contextPos]; - assertEquals(contextPath, mappedContext.name); - assertEquals(1, mappedContext.versions.length); - assertEquals("0", mappedContext.versions[0].name); + Assert.assertEquals(contextPath, mappedContext.name); + Assert.assertEquals(1, mappedContext.versions.length); + Assert.assertEquals("0", mappedContext.versions[0].name); Host oldHost = mappedHost.object; Context oldContext = mappedContext.versions[0].object; - assertEquals("context2", oldContext.getName()); + Assert.assertEquals("context2", oldContext.getName()); Context oldContext1 = mappedHost.contextList.contexts[contextPos - 1].versions[0].object; - assertEquals("context1", oldContext1.getName()); + Assert.assertEquals("context1", oldContext1.getName()); mappingData.recycle(); mapper.map(hostMB, uriMB, null, mappingData); - assertEquals("blah7", mappingData.host.getName()); - assertEquals("context2", mappingData.context.getName()); - assertEquals("wrapper5", mappingData.wrapper.getName()); + Assert.assertEquals("blah7", mappingData.host.getName()); + Assert.assertEquals("context2", mappingData.context.getName()); + Assert.assertEquals("wrapper5", mappingData.wrapper.getName()); mappingData.recycle(); mapper.map(oldContext, uriMB, mappingData); - assertEquals("wrapper5", mappingData.wrapper.getName()); + Assert.assertEquals("wrapper5", mappingData.wrapper.getName()); Context newContext = createContext("newContext"); mapper.addContextVersion( @@ -332,40 +326,40 @@ public class TestMapper extends LoggingB Arrays.asList(new WrapperMappingInfo[] { new WrapperMappingInfo( "/", createWrapper("newContext-default"), false, false) })); - assertEquals(2, mappedContext.versions.length); - assertEquals("0", mappedContext.versions[0].name); - assertEquals("1", mappedContext.versions[1].name); + Assert.assertEquals(2, mappedContext.versions.length); + Assert.assertEquals("0", mappedContext.versions[0].name); + Assert.assertEquals("1", mappedContext.versions[1].name); mappingData.recycle(); mapper.map(hostMB, uriMB, null, mappingData); - assertEquals("newContext", mappingData.context.getName()); - assertEquals("newContext-default", mappingData.wrapper.getName()); + Assert.assertEquals("newContext", mappingData.context.getName()); + Assert.assertEquals("newContext-default", mappingData.wrapper.getName()); mappingData.recycle(); mapper.map(newContext, uriMB, mappingData); - assertEquals("newContext-default", mappingData.wrapper.getName()); + Assert.assertEquals("newContext-default", mappingData.wrapper.getName()); mapper.removeContextVersion(oldContext, hostName, contextPath, "0"); - assertEquals(1, mappedContext.versions.length); - assertEquals("1", mappedContext.versions[0].name); + Assert.assertEquals(1, mappedContext.versions.length); + Assert.assertEquals("1", mappedContext.versions[0].name); mappingData.recycle(); mapper.map(hostMB, uriMB, null, mappingData); - assertEquals("newContext", mappingData.context.getName()); - assertEquals("newContext-default", mappingData.wrapper.getName()); + Assert.assertEquals("newContext", mappingData.context.getName()); + Assert.assertEquals("newContext-default", mappingData.wrapper.getName()); mappingData.recycle(); mapper.map(newContext, uriMB, mappingData); - assertEquals("newContext-default", mappingData.wrapper.getName()); + Assert.assertEquals("newContext-default", mappingData.wrapper.getName()); mapper.removeContextVersion(oldContext, hostName, contextPath, "1"); - assertNotSame(mappedContext, mappedHost.contextList.contexts[contextPos]); - assertEquals("/foo/bar/bla", mappedHost.contextList.contexts[contextPos].name); + Assert.assertNotSame(mappedContext, mappedHost.contextList.contexts[contextPos]); + Assert.assertEquals("/foo/bar/bla", mappedHost.contextList.contexts[contextPos].name); mappingData.recycle(); mapper.map(hostMB, uriMB, null, mappingData); - assertEquals("context1", mappingData.context.getName()); - assertEquals("context1-defaultWrapper", mappingData.wrapper.getName()); + Assert.assertEquals("context1", mappingData.context.getName()); + Assert.assertEquals("context1-defaultWrapper", mappingData.wrapper.getName()); mappingData.recycle(); mapper.map(oldContext1, uriMB, mappingData); - assertEquals("context1-defaultWrapper", mappingData.wrapper.getName()); + Assert.assertEquals("context1-defaultWrapper", mappingData.wrapper.getName()); mapper.addContextVersion( hostName, @@ -379,16 +373,16 @@ public class TestMapper extends LoggingB "/", createWrapper("newContext-defaultWrapper2"), false, false) })); mappedContext = mappedHost.contextList.contexts[contextPos]; - assertEquals(contextPath, mappedContext.name); - assertEquals(1, mappedContext.versions.length); - assertEquals("0", mappedContext.versions[0].name); + Assert.assertEquals(contextPath, mappedContext.name); + Assert.assertEquals(1, mappedContext.versions.length); + Assert.assertEquals("0", mappedContext.versions[0].name); mappingData.recycle(); mapper.map(hostMB, uriMB, null, mappingData); - assertEquals("newContext", mappingData.context.getName()); - assertEquals("newContext-defaultWrapper2", mappingData.wrapper.getName()); + Assert.assertEquals("newContext", mappingData.context.getName()); + Assert.assertEquals("newContext-defaultWrapper2", mappingData.wrapper.getName()); mappingData.recycle(); mapper.map(newContext, uriMB, mappingData); - assertEquals("newContext-defaultWrapper2", mappingData.wrapper.getName()); + Assert.assertEquals("newContext-defaultWrapper2", mappingData.wrapper.getName()); } @Test @@ -406,26 +400,26 @@ public class TestMapper extends LoggingB // Verifying configuration created by setUp() Mapper.MappedHost mappedHost = mapper.hosts[iowPos]; - assertEquals(hostName, mappedHost.name); + Assert.assertEquals(hostName, mappedHost.name); Mapper.MappedContext mappedContext = mappedHost.contextList.contexts[contextPos]; - assertEquals(contextPath, mappedContext.name); - assertEquals(1, mappedContext.versions.length); - assertEquals("0", mappedContext.versions[0].name); + Assert.assertEquals(contextPath, mappedContext.name); + Assert.assertEquals(1, mappedContext.versions.length); + Assert.assertEquals("0", mappedContext.versions[0].name); Host oldHost = mappedHost.object; Context oldContext = mappedContext.versions[0].object; - assertEquals("context2", oldContext.getName()); + Assert.assertEquals("context2", oldContext.getName()); Context oldContext1 = mappedHost.contextList.contexts[contextPos - 1].versions[0].object; - assertEquals("context1", oldContext1.getName()); + Assert.assertEquals("context1", oldContext1.getName()); mappingData.recycle(); mapper.map(hostMB, uriMB, null, mappingData); - assertEquals("blah7", mappingData.host.getName()); - assertEquals("context2", mappingData.context.getName()); - assertEquals("wrapper5", mappingData.wrapper.getName()); + Assert.assertEquals("blah7", mappingData.host.getName()); + Assert.assertEquals("context2", mappingData.context.getName()); + Assert.assertEquals("wrapper5", mappingData.wrapper.getName()); mappingData.recycle(); mapper.map(oldContext, uriMB, mappingData); - assertEquals("wrapper5", mappingData.wrapper.getName()); + Assert.assertEquals("wrapper5", mappingData.wrapper.getName()); // Mark context as paused // This is what happens when context reload starts @@ -433,14 +427,14 @@ public class TestMapper extends LoggingB mappingData.recycle(); mapper.map(hostMB, uriMB, null, mappingData); - assertEquals("blah7", mappingData.host.getName()); - assertEquals("context2", mappingData.context.getName()); + Assert.assertEquals("blah7", mappingData.host.getName()); + Assert.assertEquals("context2", mappingData.context.getName()); // Wrapper is not mapped for incoming requests if context is paused - assertNull(mappingData.wrapper); + Assert.assertNull(mappingData.wrapper); mappingData.recycle(); mapper.map(oldContext, uriMB, mappingData); // Wrapper is mapped for mapping method used by forward or include dispatch - assertEquals("wrapper5", mappingData.wrapper.getName()); + Assert.assertEquals("wrapper5", mappingData.wrapper.getName()); // Re-add the same context, but different list of wrappers // This is what happens when context reload completes @@ -456,18 +450,18 @@ public class TestMapper extends LoggingB "/", createWrapper("newDefaultWrapper"), false, false) })); mappedContext = mappedHost.contextList.contexts[contextPos]; - assertEquals(contextPath, mappedContext.name); - assertEquals(1, mappedContext.versions.length); - assertEquals("0", mappedContext.versions[0].name); + Assert.assertEquals(contextPath, mappedContext.name); + Assert.assertEquals(1, mappedContext.versions.length); + Assert.assertEquals("0", mappedContext.versions[0].name); mappingData.recycle(); mapper.map(hostMB, uriMB, null, mappingData); - assertEquals("blah7", mappingData.host.getName()); - assertEquals("context2", mappingData.context.getName()); - assertEquals("newDefaultWrapper", mappingData.wrapper.getName()); + Assert.assertEquals("blah7", mappingData.host.getName()); + Assert.assertEquals("context2", mappingData.context.getName()); + Assert.assertEquals("newDefaultWrapper", mappingData.wrapper.getName()); mappingData.recycle(); mapper.map(oldContext, uriMB, mappingData); - assertEquals("newDefaultWrapper", mappingData.wrapper.getName()); + Assert.assertEquals("newDefaultWrapper", mappingData.wrapper.getName()); } @Test @@ -518,24 +512,24 @@ public class TestMapper extends LoggingB uriMB.setChars(uri, 0, uri.length); mapper.map(hostMB, uriMB, null, mappingData); - assertEquals("/foo/bar/bla", mappingData.contextPath.toString()); + Assert.assertEquals("/foo/bar/bla", mappingData.contextPath.toString()); mappingData.recycle(); uriMB.setChars(uri, 0, uri.length); mapper.map(aliasMB, uriMB, null, mappingData); - assertEquals("/foo/bar/bla", mappingData.contextPath.toString()); + Assert.assertEquals("/foo/bar/bla", mappingData.contextPath.toString()); t.start(); while (running.get()) { mappingData.recycle(); uriMB.setChars(uri, 0, uri.length); mapper.map(hostMB, uriMB, null, mappingData); - assertEquals("/foo/bar/bla", mappingData.contextPath.toString()); + Assert.assertEquals("/foo/bar/bla", mappingData.contextPath.toString()); mappingData.recycle(); uriMB.setChars(uri, 0, uri.length); mapper.map(aliasMB, uriMB, null, mappingData); - assertEquals("/foo/bar/bla", mappingData.contextPath.toString()); + Assert.assertEquals("/foo/bar/bla", mappingData.contextPath.toString()); } } } Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/mapper/TestMapperPerformance.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/mapper/TestMapperPerformance.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/mapper/TestMapperPerformance.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/mapper/TestMapperPerformance.java Mon Nov 13 12:00:30 2017 @@ -16,8 +16,7 @@ */ package org.apache.catalina.mapper; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Test; import org.apache.tomcat.util.buf.MessageBytes; @@ -37,7 +36,7 @@ public class TestMapperPerformance exten time = testPerformanceImpl(); log.warn("testPerformance() test rerun completed in " + time + " ms"); } - assertTrue(String.valueOf(time), time < maxTime); + Assert.assertTrue(String.valueOf(time), time < maxTime); } private long testPerformanceImpl() throws Exception { Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/mbeans/TestRegistration.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/mbeans/TestRegistration.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/mbeans/TestRegistration.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/mbeans/TestRegistration.java Mon Nov 13 12:00:30 2017 @@ -28,10 +28,6 @@ import javax.management.MBeanServer; import javax.management.MalformedObjectNameException; import javax.management.ObjectName; -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.Test; @@ -152,16 +148,16 @@ public class TestRegistration extends To // Verify there are no Catalina or Tomcat MBeans Set<ObjectName> onames = mbeanServer.queryNames(new ObjectName("Catalina:*"), null); log.info(MBeanDumper.dumpBeans(mbeanServer, onames)); - assertEquals("Unexpected: " + onames, 0, onames.size()); + Assert.assertEquals("Unexpected: " + onames, 0, onames.size()); onames = mbeanServer.queryNames(new ObjectName("Tomcat:*"), null); log.info(MBeanDumper.dumpBeans(mbeanServer, onames)); - assertEquals("Unexpected: " + onames, 0, onames.size()); + Assert.assertEquals("Unexpected: " + onames, 0, onames.size()); final Tomcat tomcat = getTomcatInstance(); final File contextDir = new File(getTemporaryDirectory(), "webappFoo"); addDeleteOnTearDown(contextDir); if (!contextDir.mkdirs() && !contextDir.isDirectory()) { - fail("Failed to create: [" + contextDir.toString() + "]"); + Assert.fail("Failed to create: [" + contextDir.toString() + "]"); } Context ctx = tomcat.addContext(contextName, contextDir.getAbsolutePath()); @@ -182,7 +178,7 @@ public class TestRegistration extends To // Verify there are no Catalina MBeans onames = mbeanServer.queryNames(new ObjectName("Catalina:*"), null); log.info(MBeanDumper.dumpBeans(mbeanServer, onames)); - assertEquals("Found: " + onames, 0, onames.size()); + Assert.assertEquals("Found: " + onames, 0, onames.size()); // Verify there are the correct Tomcat MBeans onames = mbeanServer.queryNames(new ObjectName("Tomcat:*"), null); @@ -214,18 +210,18 @@ public class TestRegistration extends To // Did we find all expected MBeans? ArrayList<String> missing = new ArrayList<>(expected); missing.removeAll(found); - assertTrue("Missing Tomcat MBeans: " + missing, missing.isEmpty()); + Assert.assertTrue("Missing Tomcat MBeans: " + missing, missing.isEmpty()); // Did we find any unexpected MBeans? List<String> additional = found; additional.removeAll(expected); - assertTrue("Unexpected Tomcat MBeans: " + additional, additional.isEmpty()); + Assert.assertTrue("Unexpected Tomcat MBeans: " + additional, additional.isEmpty()); tomcat.stop(); // There should still be some Tomcat MBeans onames = mbeanServer.queryNames(new ObjectName("Tomcat:*"), null); - assertTrue("No Tomcat MBeans", onames.size() > 0); + Assert.assertTrue("No Tomcat MBeans", onames.size() > 0); // add a new host StandardHost host = new StandardHost(); @@ -235,7 +231,7 @@ public class TestRegistration extends To final File contextDir2 = new File(getTemporaryDirectory(), "webappFoo2"); addDeleteOnTearDown(contextDir2); if (!contextDir2.mkdirs() && !contextDir2.isDirectory()) { - fail("Failed to create: [" + contextDir2.toString() + "]"); + Assert.fail("Failed to create: [" + contextDir2.toString() + "]"); } tomcat.addContext(host, contextName + "2", contextDir2.getAbsolutePath()); @@ -246,10 +242,10 @@ public class TestRegistration extends To // There should be no Catalina MBeans and no Tomcat MBeans onames = mbeanServer.queryNames(new ObjectName("Catalina:*"), null); log.info(MBeanDumper.dumpBeans(mbeanServer, onames)); - assertEquals("Remaining: " + onames, 0, onames.size()); + Assert.assertEquals("Remaining: " + onames, 0, onames.size()); onames = mbeanServer.queryNames(new ObjectName("Tomcat:*"), null); log.info(MBeanDumper.dumpBeans(mbeanServer, onames)); - assertEquals("Remaining: " + onames, 0, onames.size()); + Assert.assertEquals("Remaining: " + onames, 0, onames.size()); } /* Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/servlets/TestDefaultServlet.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/servlets/TestDefaultServlet.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/servlets/TestDefaultServlet.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/servlets/TestDefaultServlet.java Mon Nov 13 12:00:30 2017 @@ -31,16 +31,10 @@ import java.util.TimeZone; import javax.servlet.http.HttpServletResponse; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - import org.junit.Assert; import org.junit.Test; import static org.apache.catalina.startup.SimpleHttpClient.CRLF; - import org.apache.catalina.Context; import org.apache.catalina.Wrapper; import org.apache.catalina.startup.SimpleHttpClient; @@ -71,23 +65,23 @@ public class TestDefaultServlet extends int rc =getUrl("http://localhost:" + getPort() + contextPath + "/WEB-INF/web.xml", res, null); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); rc =getUrl("http://localhost:" + getPort() + contextPath + "/WEB-INF/doesntexistanywhere", res, null); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); rc =getUrl("http://localhost:" + getPort() + contextPath + "/WEB-INF/", res, null); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); rc =getUrl("http://localhost:" + getPort() + contextPath + "/META-INF/MANIFEST.MF", res, null); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); rc =getUrl("http://localhost:" + getPort() + contextPath + "/META-INF/doesntexistanywhere", res, null); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); } @@ -128,9 +122,9 @@ public class TestDefaultServlet extends "Accept-Encoding: gzip" + CRLF + CRLF }); gzipClient.connect(); gzipClient.processRequest(); - assertTrue(gzipClient.isResponse200()); + Assert.assertTrue(gzipClient.isResponse200()); List<String> responseHeaders = gzipClient.getResponseHeaders(); - assertTrue(responseHeaders.contains("Content-Length: " + gzipSize)); + Assert.assertTrue(responseHeaders.contains("Content-Length: " + gzipSize)); gzipClient.reset(); gzipClient.setRequest(new String[] { @@ -139,11 +133,11 @@ public class TestDefaultServlet extends "Connection: Close" + CRLF+ CRLF }); gzipClient.connect(); gzipClient.processRequest(); - assertTrue(gzipClient.isResponse200()); + Assert.assertTrue(gzipClient.isResponse200()); responseHeaders = gzipClient.getResponseHeaders(); - assertTrue(responseHeaders.contains("Content-Type: text/html")); - assertFalse(responseHeaders.contains("Content-Encoding: gzip")); - assertTrue(responseHeaders.contains("Content-Length: " + indexSize)); + Assert.assertTrue(responseHeaders.contains("Content-Type: text/html")); + Assert.assertFalse(responseHeaders.contains("Content-Encoding: gzip")); + Assert.assertTrue(responseHeaders.contains("Content-Length: " + indexSize)); } /* @@ -178,23 +172,23 @@ public class TestDefaultServlet extends int rc =getUrl("http://localhost:" + getPort() + contextPath + "/static/WEB-INF/web.xml", res, null); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); rc =getUrl("http://localhost:" + getPort() + contextPath + "/static/WEB-INF/doesntexistanywhere", res, null); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); rc =getUrl("http://localhost:" + getPort() + contextPath + "/static/WEB-INF/", res, null); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); rc =getUrl("http://localhost:" + getPort() + contextPath + "/static/META-INF/MANIFEST.MF", res, null); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); rc =getUrl("http://localhost:" + getPort() + contextPath + "/static/META-INF/doesntexistanywhere", res, null); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); // Make sure DefaultServlet is serving resources relative to the // context root regardless of where the it is mapped @@ -202,18 +196,18 @@ public class TestDefaultServlet extends final ByteChunk rootResource = new ByteChunk(); rc =getUrl("http://localhost:" + getPort() + contextPath + "/index.html", rootResource, null); - assertEquals(HttpServletResponse.SC_OK, rc); + Assert.assertEquals(HttpServletResponse.SC_OK, rc); final ByteChunk subpathResource = new ByteChunk(); rc =getUrl("http://localhost:" + getPort() + contextPath + "/servlets/index.html", subpathResource, null); - assertEquals(HttpServletResponse.SC_OK, rc); + Assert.assertEquals(HttpServletResponse.SC_OK, rc); - assertFalse(rootResource.toString().equals(subpathResource.toString())); + Assert.assertFalse(rootResource.toString().equals(subpathResource.toString())); rc =getUrl("http://localhost:" + getPort() + contextPath + "/static/index.html", res, null); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); } @@ -227,7 +221,7 @@ public class TestDefaultServlet extends File webInf = new File(appDir, "WEB-INF"); addDeleteOnTearDown(appDir); if (!webInf.mkdirs() && !webInf.isDirectory()) { - fail("Unable to create directory [" + webInf + "]"); + Assert.fail("Unable to create directory [" + webInf + "]"); } File webxml = new File(appDir, "WEB-INF/web.xml"); @@ -263,8 +257,8 @@ public class TestDefaultServlet extends "GET /MyApp/missing HTTP/1.0" +CRLF + CRLF }); client.connect(); client.processRequest(); - assertTrue(client.isResponse404()); - assertEquals("It is 404.html", client.getResponseBody()); + Assert.assertTrue(client.isResponse404()); + Assert.assertEquals("It is 404.html", client.getResponseBody()); SimpleDateFormat format = new SimpleDateFormat( "EEE, dd MMM yyyy HH:mm:ss zzz", Locale.US); @@ -282,8 +276,8 @@ public class TestDefaultServlet extends "If-Modified-Since: " + tomorrow + CRLF + CRLF }); client.connect(); client.processRequest(); - assertTrue(client.isResponse404()); - assertEquals("It is 404.html", client.getResponseBody()); + Assert.assertTrue(client.isResponse404()); + Assert.assertEquals("It is 404.html", client.getResponseBody()); // https://bz.apache.org/bugzilla/show_bug.cgi?id=50413#c6 // @@ -295,8 +289,8 @@ public class TestDefaultServlet extends "Range: bytes=0-100" + CRLF + CRLF }); client.connect(); client.processRequest(); - assertTrue(client.isResponse404()); - assertEquals("It is 404.html", client.getResponseBody()); + Assert.assertTrue(client.isResponse404()); + Assert.assertEquals("It is 404.html", client.getResponseBody()); } /* @@ -309,7 +303,7 @@ public class TestDefaultServlet extends File webInf = new File(appDir, "WEB-INF"); addDeleteOnTearDown(appDir); if (!webInf.mkdirs() && !webInf.isDirectory()) { - fail("Unable to create directory [" + webInf + "]"); + Assert.fail("Unable to create directory [" + webInf + "]"); } File webxml = new File(appDir, "WEB-INF/web.xml"); @@ -339,7 +333,7 @@ public class TestDefaultServlet extends "GET /MyApp/missing HTTP/1.0" + CRLF + CRLF }); client.connect(); client.processRequest(); - assertTrue(client.isResponse404()); + Assert.assertTrue(client.isResponse404()); } /** Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/servlets/TestWebdavServlet.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/servlets/TestWebdavServlet.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/servlets/TestWebdavServlet.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/servlets/TestWebdavServlet.java Mon Nov 13 12:00:30 2017 @@ -23,8 +23,7 @@ import java.util.Map; import javax.servlet.http.HttpServletResponse; -import static org.junit.Assert.assertEquals; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.startup.Tomcat; @@ -57,23 +56,23 @@ public class TestWebdavServlet extends T int rc =getUrl("http://localhost:" + getPort() + contextPath + "/WEB-INF/web.xml", res, null); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); rc =getUrl("http://localhost:" + getPort() + contextPath + "/WEB-INF/doesntexistanywhere", res, null); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); rc =getUrl("http://localhost:" + getPort() + contextPath + "/WEB-INF/", res, null); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); rc =getUrl("http://localhost:" + getPort() + contextPath + "/META-INF/MANIFEST.MF", res, null); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); rc =getUrl("http://localhost:" + getPort() + contextPath + "/META-INF/doesntexistanywhere", res, null); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); } @@ -106,41 +105,41 @@ public class TestWebdavServlet extends T int rc =getUrl("http://localhost:" + getPort() + contextPath + "/webdav/WEB-INF/web.xml", res, null); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); rc =getUrl("http://localhost:" + getPort() + contextPath + "/webdav/WEB-INF/doesntexistanywhere", res, null); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); rc =getUrl("http://localhost:" + getPort() + contextPath + "/webdav/WEB-INF/", res, null); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); rc =getUrl("http://localhost:" + getPort() + contextPath + "/webdav/META-INF/MANIFEST.MF", res, null); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); rc =getUrl("http://localhost:" + getPort() + contextPath + "/webdav/META-INF/doesntexistanywhere", res, null); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); // Make sure WebdavServlet is serving resources // relative to the map/mount point final ByteChunk rootResource = new ByteChunk(); rc =getUrl("http://localhost:" + getPort() + contextPath + "/index.html", rootResource, null); - assertEquals(HttpServletResponse.SC_OK, rc); + Assert.assertEquals(HttpServletResponse.SC_OK, rc); final ByteChunk subpathResource = new ByteChunk(); rc =getUrl("http://localhost:" + getPort() + contextPath + "/webdav/index.html", subpathResource, null); - assertEquals(HttpServletResponse.SC_OK, rc); + Assert.assertEquals(HttpServletResponse.SC_OK, rc); - assertEquals(rootResource.toString(), subpathResource.toString()); + Assert.assertEquals(rootResource.toString(), subpathResource.toString()); rc =getUrl("http://localhost:" + getPort() + contextPath + "/webdav/static/index.html", res, null); - assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); + Assert.assertEquals(HttpServletResponse.SC_NOT_FOUND, rc); } Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/session/Benchmarks.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/session/Benchmarks.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/session/Benchmarks.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/session/Benchmarks.java Mon Nov 13 12:00:30 2017 @@ -22,8 +22,7 @@ import java.io.IOException; import java.io.InputStream; import java.security.SecureRandom; -import static org.junit.Assert.fail; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.LifecycleException; @@ -105,7 +104,7 @@ public class Benchmarks { threads[i].join(); } catch (InterruptedException e) { e.printStackTrace(); - fail(e.getMessage()); + Assert.fail(e.getMessage()); } } long end = System.currentTimeMillis(); @@ -201,7 +200,7 @@ public class Benchmarks { threads[i].join(); } catch (InterruptedException e) { e.printStackTrace(); - fail(e.getMessage()); + Assert.fail(e.getMessage()); } } long end = System.currentTimeMillis(); @@ -286,7 +285,7 @@ public class Benchmarks { threads[i].join(); } catch (InterruptedException e) { e.printStackTrace(); - fail(e.getMessage()); + Assert.fail(e.getMessage()); } } long end = System.currentTimeMillis(); Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/session/Threading.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/session/Threading.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/session/Threading.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/session/Threading.java Mon Nov 13 12:00:30 2017 @@ -20,8 +20,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; -import static org.junit.Assert.fail; - +import org.junit.Assert; import org.junit.Test; /** @@ -82,11 +81,11 @@ public class Threading { try { threads[i].join(); if (runnables[i].isfailed()) { - fail(); + Assert.fail(); } } catch (InterruptedException e) { e.printStackTrace(); - fail(e.getMessage()); + Assert.fail(e.getMessage()); } } long end = System.currentTimeMillis(); Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/startup/LoggingBaseTest.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/startup/LoggingBaseTest.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/startup/LoggingBaseTest.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/startup/LoggingBaseTest.java Mon Nov 13 12:00:30 2017 @@ -24,10 +24,9 @@ import java.util.ArrayList; import java.util.List; import java.util.logging.LogManager; -import static org.junit.Assert.fail; - import org.junit.After; import org.junit.AfterClass; +import org.junit.Assert; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Rule; @@ -117,7 +116,7 @@ public abstract class LoggingBaseTest { // Create catalina.base directory File tempBase = new File(System.getProperty("tomcat.test.temp", "output/tmp")); if (!tempBase.mkdirs() && !tempBase.isDirectory()) { - fail("Unable to create base temporary directory for tests"); + Assert.fail("Unable to create base temporary directory for tests"); } Path tempBasePath = FileSystems.getDefault().getPath(tempBase.getAbsolutePath()); tempDir = Files.createTempDirectory(tempBasePath, "test").toFile(); Modified: tomcat/tc8.0.x/trunk/test/org/apache/catalina/startup/TestBootstrap.java URL: http://svn.apache.org/viewvc/tomcat/tc8.0.x/trunk/test/org/apache/catalina/startup/TestBootstrap.java?rev=1815090&r1=1815089&r2=1815090&view=diff ============================================================================== --- tomcat/tc8.0.x/trunk/test/org/apache/catalina/startup/TestBootstrap.java (original) +++ tomcat/tc8.0.x/trunk/test/org/apache/catalina/startup/TestBootstrap.java Mon Nov 13 12:00:30 2017 @@ -16,8 +16,7 @@ */ package org.apache.catalina.startup; -import static org.junit.Assert.assertArrayEquals; - +import org.junit.Assert; import org.junit.Test; @@ -176,6 +175,6 @@ public class TestBootstrap { private void doTest(String input, String... expected) { String[] result = Bootstrap.getPaths(input); - assertArrayEquals(expected, result); + Assert.assertArrayEquals(expected, result); } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org