Modified: tomcat/trunk/test/org/apache/catalina/mapper/TestMapper.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/mapper/TestMapper.java?rev=1815079&r1=1815078&r2=1815079&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/mapper/TestMapper.java (original) +++ tomcat/trunk/test/org/apache/catalina/mapper/TestMapper.java Mon Nov 13 10:49:13 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; @@ -165,14 +159,14 @@ public class TestMapper extends LoggingB // Check we have the right number // (added 17 including one host alias. Three duplicates do not increase the count.) - assertEquals(19, mapper.hosts.length); + Assert.assertEquals(19, mapper.hosts.length); // Make sure adding a duplicate *does not* overwrite final int iowPos = 4; - assertEquals("blah7", mapper.hosts[iowPos].object.getName()); + Assert.assertEquals("blah7", mapper.hosts[iowPos].object.getName()); final int qwigPos = 10; - assertEquals("blah14", mapper.hosts[qwigPos].object.getName()); + Assert.assertEquals("blah14", mapper.hosts[qwigPos].object.getName()); // Check for alphabetical order of host names String previous; @@ -180,69 +174,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(19, mapper.hosts.length); + Assert.assertEquals(19, mapper.hosts.length); mapper.addContextVersion("zzzz", hostZ, "/", "", contextZ, null, null, null); - assertEquals(20, mapper.hosts.length); + Assert.assertEquals(20, mapper.hosts.length); mapper.addHost("zzzz", new String[] { "zzzz_alias1", "zzzz_alias2" }, hostZ); - assertEquals(22, mapper.hosts.length); + Assert.assertEquals(22, mapper.hosts.length); - assertEquals("zzzz", mapper.hosts[19].name); - assertEquals("zzzz_alias1", mapper.hosts[20].name); - assertEquals("zzzz_alias2", mapper.hosts[21].name); - assertEquals(2, mapper.hosts[19].getAliases().size()); - assertSame(contextZ, + Assert.assertEquals("zzzz", mapper.hosts[19].name); + Assert.assertEquals("zzzz_alias1", mapper.hosts[20].name); + Assert.assertEquals("zzzz_alias2", mapper.hosts[21].name); + Assert.assertEquals(2, mapper.hosts[19].getAliases().size()); + Assert.assertSame(contextZ, mapper.hosts[19].contextList.contexts[0].versions[0].object); - assertSame(contextZ, + Assert.assertSame(contextZ, mapper.hosts[21].contextList.contexts[0].versions[0].object); } @Test public void testRemoveHost() { - assertEquals(19, mapper.hosts.length); + Assert.assertEquals(19, mapper.hosts.length); mapper.removeHostAlias("iowejoiejfoiew"); mapper.removeHost("iowejoiejfoiew_alias"); - assertEquals(19, mapper.hosts.length); // No change + Assert.assertEquals(19, mapper.hosts.length); // No change mapper.removeHostAlias("iowejoiejfoiew_alias"); - assertEquals(18, mapper.hosts.length); // Removed + Assert.assertEquals(18, mapper.hosts.length); // Removed mapper.addHostAlias("iowejoiejfoiew", "iowejoiejfoiew_alias"); - assertEquals(19, mapper.hosts.length); + Assert.assertEquals(19, mapper.hosts.length); final int iowPos = 4; 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(17, mapper.hosts.length); // Both host and alias removed + Assert.assertEquals(17, 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")); } } @@ -261,13 +255,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(); @@ -275,13 +269,13 @@ 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.recycle(); @@ -289,26 +283,26 @@ public class TestMapper extends LoggingB uri.toChars(); uri.getCharChunk().setLimit(-1); mapper.map(wildcard, uri, null, mappingData); - assertEquals("blah16", mappingData.host.getName()); - assertEquals("context4", mappingData.context.getName()); - assertEquals("context4-defaultWrapper", mappingData.wrapper.getName()); - assertEquals("", mappingData.contextPath.toString()); - assertEquals("/foo/bar/bla/bobou/foo", mappingData.wrapperPath.toString()); - assertTrue(mappingData.pathInfo.isNull()); - assertTrue(mappingData.redirectPath.isNull()); + Assert.assertEquals("blah16", mappingData.host.getName()); + Assert.assertEquals("context4", mappingData.context.getName()); + Assert.assertEquals("context4-defaultWrapper", mappingData.wrapper.getName()); + Assert.assertEquals("", mappingData.contextPath.toString()); + Assert.assertEquals("/foo/bar/bla/bobou/foo", mappingData.wrapperPath.toString()); + Assert.assertTrue(mappingData.pathInfo.isNull()); + 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 @@ -326,26 +320,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( @@ -359,40 +353,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, @@ -406,16 +400,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 @@ -433,26 +427,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 @@ -460,14 +454,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 @@ -483,18 +477,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 @@ -545,24 +539,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/trunk/test/org/apache/catalina/mapper/TestMapperPerformance.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/mapper/TestMapperPerformance.java?rev=1815079&r1=1815078&r2=1815079&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/mapper/TestMapperPerformance.java (original) +++ tomcat/trunk/test/org/apache/catalina/mapper/TestMapperPerformance.java Mon Nov 13 10:49:13 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; @@ -55,7 +54,7 @@ public class TestMapperPerformance exten time = testPerformanceImpl(requestedHostName); 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(String requestedHostName) throws Exception { Modified: tomcat/trunk/test/org/apache/catalina/mbeans/TestRegistration.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/mbeans/TestRegistration.java?rev=1815079&r1=1815078&r2=1815079&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/mbeans/TestRegistration.java (original) +++ tomcat/trunk/test/org/apache/catalina/mbeans/TestRegistration.java Mon Nov 13 10:49:13 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()); @@ -177,7 +173,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); @@ -207,18 +203,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(); @@ -228,7 +224,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()); @@ -239,10 +235,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/trunk/test/org/apache/catalina/servlets/TestDefaultServlet.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/servlets/TestDefaultServlet.java?rev=1815079&r1=1815078&r2=1815079&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/servlets/TestDefaultServlet.java (original) +++ tomcat/trunk/test/org/apache/catalina/servlets/TestDefaultServlet.java Mon Nov 13 10:49:13 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; @@ -72,23 +66,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); } @@ -130,11 +124,11 @@ public class TestDefaultServlet extends "Accept-Encoding: gzip, br" + CRLF + CRLF }); gzipClient.connect(); gzipClient.processRequest(); - assertTrue(gzipClient.isResponse200()); + Assert.assertTrue(gzipClient.isResponse200()); List<String> responseHeaders = gzipClient.getResponseHeaders(); - assertTrue(responseHeaders.contains("Content-Encoding: gzip")); - assertTrue(responseHeaders.contains("Content-Length: " + gzipSize)); - assertTrue(responseHeaders.contains("Vary: accept-encoding")); + Assert.assertTrue(responseHeaders.contains("Content-Encoding: gzip")); + Assert.assertTrue(responseHeaders.contains("Content-Length: " + gzipSize)); + Assert.assertTrue(responseHeaders.contains("Vary: accept-encoding")); gzipClient.reset(); gzipClient.setRequest(new String[] { @@ -143,12 +137,12 @@ 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)); - assertTrue(responseHeaders.contains("Vary: accept-encoding")); + Assert.assertTrue(responseHeaders.contains("Content-Type: text/html")); + Assert.assertFalse(responseHeaders.contains("Content-Encoding: gzip")); + Assert.assertTrue(responseHeaders.contains("Content-Length: " + indexSize)); + Assert.assertTrue(responseHeaders.contains("Vary: accept-encoding")); } /* @@ -186,11 +180,11 @@ public class TestDefaultServlet extends "Accept-Encoding: br, gzip" + CRLF + CRLF }); client.connect(); client.processRequest(); - assertTrue(client.isResponse200()); + Assert.assertTrue(client.isResponse200()); List<String> responseHeaders = client.getResponseHeaders(); - assertTrue(responseHeaders.contains("Content-Encoding: br")); - assertTrue(responseHeaders.contains("Content-Length: " + brSize)); - assertTrue(responseHeaders.contains("Vary: accept-encoding")); + Assert.assertTrue(responseHeaders.contains("Content-Encoding: br")); + Assert.assertTrue(responseHeaders.contains("Content-Length: " + brSize)); + Assert.assertTrue(responseHeaders.contains("Vary: accept-encoding")); client.reset(); client.setRequest(new String[] { @@ -199,12 +193,12 @@ public class TestDefaultServlet extends "Connection: Close" + CRLF+ CRLF }); client.connect(); client.processRequest(); - assertTrue(client.isResponse200()); + Assert.assertTrue(client.isResponse200()); responseHeaders = client.getResponseHeaders(); - assertTrue(responseHeaders.contains("Content-Type: text/html")); - assertFalse(responseHeaders.contains("Content-Encoding")); - assertTrue(responseHeaders.contains("Content-Length: " + indexSize)); - assertTrue(responseHeaders.contains("Vary: accept-encoding")); + Assert.assertTrue(responseHeaders.contains("Content-Type: text/html")); + Assert.assertFalse(responseHeaders.contains("Content-Encoding")); + Assert.assertTrue(responseHeaders.contains("Content-Length: " + indexSize)); + Assert.assertTrue(responseHeaders.contains("Vary: accept-encoding")); } /* @@ -241,11 +235,11 @@ public class TestDefaultServlet extends "Accept-Encoding: br, gzip ; q = 0.5 , custom" + CRLF + CRLF }); client.connect(); client.processRequest(); - assertTrue(client.isResponse200()); + Assert.assertTrue(client.isResponse200()); List<String> responseHeaders = client.getResponseHeaders(); - assertTrue(responseHeaders.contains("Content-Encoding: custom")); - assertTrue(responseHeaders.contains("Content-Length: " + brSize)); - assertTrue(responseHeaders.contains("Vary: accept-encoding")); + Assert.assertTrue(responseHeaders.contains("Content-Encoding: custom")); + Assert.assertTrue(responseHeaders.contains("Content-Length: " + brSize)); + Assert.assertTrue(responseHeaders.contains("Vary: accept-encoding")); client.reset(); client.setRequest(new String[] { @@ -255,11 +249,11 @@ public class TestDefaultServlet extends "Accept-Encoding: br;q=1,gzip,custom" + CRLF + CRLF }); client.connect(); client.processRequest(); - assertTrue(client.isResponse200()); + Assert.assertTrue(client.isResponse200()); responseHeaders = client.getResponseHeaders(); - assertTrue(responseHeaders.contains("Content-Encoding: gzip")); - assertTrue(responseHeaders.contains("Content-Length: " + gzSize)); - assertTrue(responseHeaders.contains("Vary: accept-encoding")); + Assert.assertTrue(responseHeaders.contains("Content-Encoding: gzip")); + Assert.assertTrue(responseHeaders.contains("Content-Length: " + gzSize)); + Assert.assertTrue(responseHeaders.contains("Vary: accept-encoding")); } /* @@ -297,11 +291,11 @@ public class TestDefaultServlet extends "Accept-Encoding: gzip;q=0.9,*" + CRLF + CRLF }); client.connect(); client.processRequest(); - assertTrue(client.isResponse200()); + Assert.assertTrue(client.isResponse200()); List<String> responseHeaders = client.getResponseHeaders(); - assertTrue(responseHeaders.contains("Content-Encoding: br")); - assertTrue(responseHeaders.contains("Content-Length: " + brSize)); - assertTrue(responseHeaders.contains("Vary: accept-encoding")); + Assert.assertTrue(responseHeaders.contains("Content-Encoding: br")); + Assert.assertTrue(responseHeaders.contains("Content-Length: " + brSize)); + Assert.assertTrue(responseHeaders.contains("Vary: accept-encoding")); client.reset(); client.setRequest(new String[] { @@ -311,11 +305,11 @@ public class TestDefaultServlet extends "Accept-Encoding: gzip;q=0.9,br;q=0,identity," + CRLF + CRLF }); client.connect(); client.processRequest(); - assertTrue(client.isResponse200()); + Assert.assertTrue(client.isResponse200()); responseHeaders = client.getResponseHeaders(); - assertFalse(responseHeaders.contains("Content-Encoding")); - assertTrue(responseHeaders.contains("Content-Length: " + indexSize)); - assertTrue(responseHeaders.contains("Vary: accept-encoding")); + Assert.assertFalse(responseHeaders.contains("Content-Encoding")); + Assert.assertTrue(responseHeaders.contains("Content-Length: " + indexSize)); + Assert.assertTrue(responseHeaders.contains("Vary: accept-encoding")); } /* @@ -352,11 +346,11 @@ public class TestDefaultServlet extends "Accept-Encoding: gzip, deflate, br" + CRLF + CRLF }); client.connect(); client.processRequest(); - assertTrue(client.isResponse200()); + Assert.assertTrue(client.isResponse200()); List<String> responseHeaders = client.getResponseHeaders(); - assertTrue(responseHeaders.contains("Content-Encoding: br")); - assertTrue(responseHeaders.contains("Content-Length: " + brSize)); - assertTrue(responseHeaders.contains("Vary: accept-encoding")); + Assert.assertTrue(responseHeaders.contains("Content-Encoding: br")); + Assert.assertTrue(responseHeaders.contains("Content-Length: " + brSize)); + Assert.assertTrue(responseHeaders.contains("Vary: accept-encoding")); // Chrome 50 Accept-Encoding client.reset(); @@ -367,11 +361,11 @@ public class TestDefaultServlet extends "Accept-Encoding: gzip, deflate, sdch, br" + CRLF + CRLF }); client.connect(); client.processRequest(); - assertTrue(client.isResponse200()); + Assert.assertTrue(client.isResponse200()); responseHeaders = client.getResponseHeaders(); - assertTrue(responseHeaders.contains("Content-Encoding: br")); - assertTrue(responseHeaders.contains("Content-Length: " + brSize)); - assertTrue(responseHeaders.contains("Vary: accept-encoding")); + Assert.assertTrue(responseHeaders.contains("Content-Encoding: br")); + Assert.assertTrue(responseHeaders.contains("Content-Length: " + brSize)); + Assert.assertTrue(responseHeaders.contains("Vary: accept-encoding")); } /* @@ -406,23 +400,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 @@ -430,18 +424,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); } @@ -479,8 +473,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); @@ -498,8 +492,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 // @@ -511,8 +505,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()); } /* @@ -525,7 +519,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"); @@ -555,7 +549,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/trunk/test/org/apache/catalina/servlets/TestWebdavServlet.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/servlets/TestWebdavServlet.java?rev=1815079&r1=1815078&r2=1815079&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/servlets/TestWebdavServlet.java (original) +++ tomcat/trunk/test/org/apache/catalina/servlets/TestWebdavServlet.java Mon Nov 13 10:49:13 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/trunk/test/org/apache/catalina/session/Benchmarks.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/session/Benchmarks.java?rev=1815079&r1=1815078&r2=1815079&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/session/Benchmarks.java (original) +++ tomcat/trunk/test/org/apache/catalina/session/Benchmarks.java Mon Nov 13 10:49:13 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.Context; @@ -108,7 +107,7 @@ public class Benchmarks { threads[i].join(); } catch (InterruptedException e) { e.printStackTrace(); - fail(e.getMessage()); + Assert.fail(e.getMessage()); } } long end = System.currentTimeMillis(); @@ -206,7 +205,7 @@ public class Benchmarks { threads[i].join(); } catch (InterruptedException e) { e.printStackTrace(); - fail(e.getMessage()); + Assert.fail(e.getMessage()); } } long end = System.currentTimeMillis(); @@ -291,7 +290,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/trunk/test/org/apache/catalina/session/Threading.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/session/Threading.java?rev=1815079&r1=1815078&r2=1815079&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/session/Threading.java (original) +++ tomcat/trunk/test/org/apache/catalina/session/Threading.java Mon Nov 13 10:49:13 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/trunk/test/org/apache/catalina/startup/LoggingBaseTest.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/LoggingBaseTest.java?rev=1815079&r1=1815078&r2=1815079&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/startup/LoggingBaseTest.java (original) +++ tomcat/trunk/test/org/apache/catalina/startup/LoggingBaseTest.java Mon Nov 13 10:49:13 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/trunk/test/org/apache/catalina/startup/TestBootstrap.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TestBootstrap.java?rev=1815079&r1=1815078&r2=1815079&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/startup/TestBootstrap.java (original) +++ tomcat/trunk/test/org/apache/catalina/startup/TestBootstrap.java Mon Nov 13 10:49:13 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); } } Modified: tomcat/trunk/test/org/apache/catalina/startup/TestContextConfigAnnotation.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TestContextConfigAnnotation.java?rev=1815079&r1=1815078&r2=1815079&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/startup/TestContextConfigAnnotation.java (original) +++ tomcat/trunk/test/org/apache/catalina/startup/TestContextConfigAnnotation.java Mon Nov 13 10:49:13 2017 @@ -31,12 +31,7 @@ import javax.servlet.ServletContainerIni import javax.servlet.ServletContext; import javax.servlet.ServletException; -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 static org.junit.Assert.fail; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.Context; @@ -63,23 +58,23 @@ public class TestContextConfigAnnotation ContextConfig config = new ContextConfig(); File pFile = paramClassResource( "org/apache/catalina/startup/ParamServlet"); - assertTrue(pFile.exists()); + Assert.assertTrue(pFile.exists()); config.processAnnotationsFile(pFile, webxml, false, javaClassCache); ServletDef servletDef = webxml.getServlets().get("param"); - assertNotNull(servletDef); - assertEquals("Hello", servletDef.getParameterMap().get("foo")); - assertEquals("World!", servletDef.getParameterMap().get("bar")); - assertEquals("param", webxml.getServletMappings().get( + Assert.assertNotNull(servletDef); + Assert.assertEquals("Hello", servletDef.getParameterMap().get("foo")); + Assert.assertEquals("World!", servletDef.getParameterMap().get("bar")); + Assert.assertEquals("param", webxml.getServletMappings().get( "/annotation/overwrite")); - assertEquals("param", servletDef.getDescription()); - assertEquals("param", servletDef.getDisplayName()); - assertEquals("paramLarge.png", servletDef.getLargeIcon()); - assertEquals("paramSmall.png", servletDef.getSmallIcon()); - assertEquals(Boolean.FALSE, servletDef.getAsyncSupported()); - assertEquals(Integer.valueOf(0), servletDef.getLoadOnStartup()); - assertNull(servletDef.getEnabled()); - assertNull(servletDef.getJspFile()); + Assert.assertEquals("param", servletDef.getDescription()); + Assert.assertEquals("param", servletDef.getDisplayName()); + Assert.assertEquals("paramLarge.png", servletDef.getLargeIcon()); + Assert.assertEquals("paramSmall.png", servletDef.getSmallIcon()); + Assert.assertEquals(Boolean.FALSE, servletDef.getAsyncSupported()); + Assert.assertEquals(Integer.valueOf(0), servletDef.getLoadOnStartup()); + Assert.assertNull(servletDef.getEnabled()); + Assert.assertNull(servletDef.getJspFile()); } @@ -103,25 +98,25 @@ public class TestContextConfigAnnotation ContextConfig config = new ContextConfig(); File pFile = paramClassResource( "org/apache/catalina/startup/ParamServlet"); - assertTrue(pFile.exists()); + Assert.assertTrue(pFile.exists()); config.processAnnotationsFile(pFile, webxml, false, javaClassCache); - assertEquals(servletDef, webxml.getServlets().get("param")); + Assert.assertEquals(servletDef, webxml.getServlets().get("param")); - assertEquals("tomcat", servletDef.getParameterMap().get("foo")); - assertEquals("param", webxml.getServletMappings().get("/param")); + Assert.assertEquals("tomcat", servletDef.getParameterMap().get("foo")); + Assert.assertEquals("param", webxml.getServletMappings().get("/param")); // annotation mapping not added s. Servlet Spec 3.0 (Nov 2009) // 8.2.3.3.iv page 81 - assertNull(webxml.getServletMappings().get("/annotation/overwrite")); + Assert.assertNull(webxml.getServletMappings().get("/annotation/overwrite")); - assertEquals("Description", servletDef.getDescription()); - assertEquals("DisplayName", servletDef.getDisplayName()); - assertEquals("LargeIcon", servletDef.getLargeIcon()); - assertEquals("SmallIcon", servletDef.getSmallIcon()); - assertEquals(Boolean.TRUE, servletDef.getAsyncSupported()); - assertEquals(Integer.valueOf(1), servletDef.getLoadOnStartup()); - assertNull(servletDef.getEnabled()); - assertNull(servletDef.getJspFile()); + Assert.assertEquals("Description", servletDef.getDescription()); + Assert.assertEquals("DisplayName", servletDef.getDisplayName()); + Assert.assertEquals("LargeIcon", servletDef.getLargeIcon()); + Assert.assertEquals("SmallIcon", servletDef.getSmallIcon()); + Assert.assertEquals(Boolean.TRUE, servletDef.getAsyncSupported()); + Assert.assertEquals(Integer.valueOf(1), servletDef.getLoadOnStartup()); + Assert.assertNull(servletDef.getEnabled()); + Assert.assertNull(servletDef.getJspFile()); } @Test @@ -131,15 +126,15 @@ public class TestContextConfigAnnotation ContextConfig config = new ContextConfig(); File pFile = paramClassResource( "org/apache/catalina/startup/NoMappingParamServlet"); - assertTrue(pFile.exists()); + Assert.assertTrue(pFile.exists()); config.processAnnotationsFile(pFile, webxml, false, javaClassCache); ServletDef servletDef = webxml.getServlets().get("param1"); - assertNull(servletDef); + Assert.assertNull(servletDef); webxml.addServletMapping("/param", "param1"); config.processAnnotationsFile(pFile, webxml, false, javaClassCache); servletDef = webxml.getServlets().get("param1"); - assertNull(servletDef); + Assert.assertNull(servletDef); } @@ -158,13 +153,13 @@ public class TestContextConfigAnnotation ContextConfig config = new ContextConfig(); File pFile = paramClassResource( "org/apache/catalina/startup/NoMappingParamServlet"); - assertTrue(pFile.exists()); + Assert.assertTrue(pFile.exists()); config.processAnnotationsFile(pFile, webxml, false, javaClassCache); - assertEquals("tomcat", servletDef.getParameterMap().get("foo")); - assertEquals("World!", servletDef.getParameterMap().get("bar")); + Assert.assertEquals("tomcat", servletDef.getParameterMap().get("foo")); + Assert.assertEquals("World!", servletDef.getParameterMap().get("bar")); ServletDef servletDef1 = webxml.getServlets().get("param1"); - assertNotNull(servletDef1); - assertEquals(servletDef, servletDef1); + Assert.assertNotNull(servletDef1); + Assert.assertEquals(servletDef, servletDef1); } @Test @@ -174,15 +169,15 @@ public class TestContextConfigAnnotation ContextConfig config = new ContextConfig(); File pFile = paramClassResource( "org/apache/catalina/startup/DuplicateMappingParamServlet"); - assertTrue(pFile.exists()); + Assert.assertTrue(pFile.exists()); try { config.processAnnotationsFile(pFile, webxml, false, javaClassCache); - fail(); + Assert.fail(); } catch (IllegalArgumentException ex) { // ignore } ServletDef servletDef = webxml.getServlets().get("param"); - assertNull(servletDef); + Assert.assertNull(servletDef); } @Test @@ -197,8 +192,8 @@ public class TestContextConfigAnnotation "org/apache/catalina/startup/ParamFilter"); config.processAnnotationsFile(fFile, webxml, false, javaClassCache); FilterDef fdef = webxml.getFilters().get("paramFilter"); - assertNotNull(fdef); - assertEquals("Servlet says: ",fdef.getParameterMap().get("message")); + Assert.assertNotNull(fdef); + Assert.assertEquals("Servlet says: ",fdef.getParameterMap().get("message")); } @Test @@ -230,30 +225,30 @@ public class TestContextConfigAnnotation "org/apache/catalina/startup/ParamFilter"); config.processAnnotationsFile(fFile, webxml, false, javaClassCache); FilterDef fdef = webxml.getFilters().get("paramFilter"); - assertNotNull(fdef); - assertEquals(filterDef,fdef); - assertEquals("tomcat",fdef.getParameterMap().get("message")); + Assert.assertNotNull(fdef); + Assert.assertEquals(filterDef,fdef); + Assert.assertEquals("tomcat",fdef.getParameterMap().get("message")); Set<FilterMap> filterMappings = webxml.getFilterMappings(); - assertTrue(filterMappings.contains(filterMap)); + Assert.assertTrue(filterMappings.contains(filterMap)); // annotation mapping not added s. Servlet Spec 3.0 (Nov 2009) // 8.2.3.3.vi page 81 String[] urlPatterns = filterMap.getURLPatterns(); - assertNotNull(urlPatterns); - assertEquals(1,urlPatterns.length); - assertEquals("/param1",urlPatterns[0]); + Assert.assertNotNull(urlPatterns); + Assert.assertEquals(1,urlPatterns.length); + Assert.assertEquals("/param1",urlPatterns[0]); // check simple Parameter - assertEquals("Description", fdef.getDescription()); - assertEquals("DisplayName", fdef.getDisplayName()); - assertEquals("LargeIcon", fdef.getLargeIcon()); - assertEquals("SmallIcon", fdef.getSmallIcon()); + Assert.assertEquals("Description", fdef.getDescription()); + Assert.assertEquals("DisplayName", fdef.getDisplayName()); + Assert.assertEquals("LargeIcon", fdef.getLargeIcon()); + Assert.assertEquals("SmallIcon", fdef.getSmallIcon()); // FIXME: Strange why servletDef is Boolean and FilterDef is String? - assertEquals("true", fdef.getAsyncSupported()); + Assert.assertEquals("true", fdef.getAsyncSupported()); String[] dis = filterMap.getDispatcherNames(); - assertEquals(2, dis.length); - assertEquals(DispatcherType.ERROR.toString(),dis[0]); - assertEquals(DispatcherType.ASYNC.toString(),dis[1]); + Assert.assertEquals(2, dis.length); + Assert.assertEquals(DispatcherType.ERROR.toString(),dis[0]); + Assert.assertEquals(DispatcherType.ASYNC.toString(),dis[1]); } @@ -264,15 +259,15 @@ public class TestContextConfigAnnotation ContextConfig config = new ContextConfig(); File pFile = paramClassResource( "org/apache/catalina/startup/DuplicateMappingParamFilter"); - assertTrue(pFile.exists()); + Assert.assertTrue(pFile.exists()); try { config.processAnnotationsFile(pFile, webxml, false, javaClassCache); - fail(); + Assert.fail(); } catch (IllegalArgumentException ex) { // ignore } FilterDef filterDef = webxml.getFilters().get("paramD"); - assertNull(filterDef); + Assert.assertNull(filterDef); } @Test @@ -318,9 +313,9 @@ public class TestContextConfigAnnotation config.processAnnotationsFile(file, ignore, false, javaClassCache); // Check right number of classes were noted to be handled - assertEquals(0, config.initializerClassMap.get(sciNone).size()); - assertEquals(2, config.initializerClassMap.get(sciServlet).size()); - assertEquals(4, config.initializerClassMap.get(sciObject).size()); + Assert.assertEquals(0, config.initializerClassMap.get(sciNone).size()); + Assert.assertEquals(2, config.initializerClassMap.get(sciServlet).size()); + Assert.assertEquals(4, config.initializerClassMap.get(sciObject).size()); } private static final class SCI implements ServletContainerInitializer { @@ -369,7 +364,7 @@ public class TestContextConfigAnnotation */ private File paramClassResource(String className) throws URISyntaxException { URL url = getClass().getClassLoader().getResource(className + ".class"); - assertNotNull(url); + Assert.assertNotNull(url); File file = new File(url.toURI()); return file; Modified: tomcat/trunk/test/org/apache/catalina/startup/TestListener.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TestListener.java?rev=1815079&r1=1815078&r2=1815079&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/startup/TestListener.java (original) +++ tomcat/trunk/test/org/apache/catalina/startup/TestListener.java Mon Nov 13 10:49:13 2017 @@ -24,9 +24,7 @@ import javax.servlet.ServletContextEvent import javax.servlet.ServletContextListener; import javax.servlet.ServletException; -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; @@ -47,7 +45,7 @@ public class TestListener extends Tomcat context.addServletContainerInitializer(new SCI(), null); tomcat.start(); - assertTrue(SCL.initialized); + Assert.assertTrue(SCL.initialized); } /* @@ -68,7 +66,7 @@ public class TestListener extends Tomcat tomcat.start(); //check that the ServletContextInitializer wasn't initialized. - assertFalse(SCL3.initialized); + Assert.assertFalse(SCL3.initialized); } public static class SCI implements ServletContainerInitializer { Modified: tomcat/trunk/test/org/apache/catalina/startup/TestTomcat.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TestTomcat.java?rev=1815079&r1=1815078&r2=1815079&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/startup/TestTomcat.java (original) +++ tomcat/trunk/test/org/apache/catalina/startup/TestTomcat.java Mon Nov 13 10:49:13 2017 @@ -33,12 +33,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.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - import org.junit.Assert; import org.junit.Test; @@ -198,7 +192,7 @@ public class TestTomcat extends TomcatBa tomcat.start(); ByteChunk res = getUrl("http://localhost:" + getPort() + "/"); - assertEquals("Hello world", res.toString()); + Assert.assertEquals("Hello world", res.toString()); } @Test @@ -215,7 +209,7 @@ public class TestTomcat extends TomcatBa ByteChunk res = getUrl("http://localhost:" + getPort() + "/examples/servlets/servlet/HelloWorldExample"); String text = res.toString(); - assertTrue(text, text.indexOf("<a href=\"../helloworld.html\">") > 0); + Assert.assertTrue(text, text.indexOf("<a href=\"../helloworld.html\">") > 0); } @Test @@ -233,7 +227,7 @@ public class TestTomcat extends TomcatBa ByteChunk res = getUrl("http://localhost:" + getPort() + "/examples/jsp/jsp2/el/basic-arithmetic.jsp"); String text = res.toString(); - assertTrue(text, text.indexOf("<td>${(1==2) ? 3 : 4}</td>") > 0); + Assert.assertTrue(text, text.indexOf("<td>${(1==2) ? 3 : 4}</td>") > 0); } @Test @@ -249,7 +243,7 @@ public class TestTomcat extends TomcatBa tomcat.start(); ByteChunk res = getUrl("http://localhost:" + getPort() + "/"); - assertEquals("Hello world", res.toString()); + Assert.assertEquals("Hello world", res.toString()); } @Test @@ -288,7 +282,7 @@ public class TestTomcat extends TomcatBa tomcat.start(); ByteChunk res = getUrl("http://localhost:" + getPort() + "/"); - assertEquals("Hello, Tomcat User", res.toString()); + Assert.assertEquals("Hello, Tomcat User", res.toString()); } /* @@ -322,7 +316,7 @@ public class TestTomcat extends TomcatBa tomcat.start(); ByteChunk res = getUrl("http://localhost:" + getPort() + "/"); - assertEquals("Hello, Tomcat User", res.toString()); + Assert.assertEquals("Hello, Tomcat User", res.toString()); } @@ -350,8 +344,8 @@ public class TestTomcat extends TomcatBa int rc =getUrl("http://localhost:" + getPort() + contextPath + "/testGetResource", res, null); - assertEquals(HttpServletResponse.SC_OK, rc); - assertTrue(res.toString().contains("<?xml version=\"1.0\" ")); + Assert.assertEquals(HttpServletResponse.SC_OK, rc); + Assert.assertTrue(res.toString().contains("<?xml version=\"1.0\" ")); } @Test @@ -370,7 +364,7 @@ public class TestTomcat extends TomcatBa ex.printStackTrace(); e = ex; } - assertNull(e); + Assert.assertNull(e); } @Test @@ -387,33 +381,33 @@ public class TestTomcat extends TomcatBa tomcat.start(); ByteChunk res = getUrl("http://localhost:" + getPort() + "/"); - assertEquals("OK", res.toString()); + Assert.assertEquals("OK", res.toString()); - assertEquals(1, initCount.getCallCount()); + Assert.assertEquals(1, initCount.getCallCount()); } @Test public void testGetWebappConfigFileFromDirectory() { Tomcat tomcat = new Tomcat(); - assertNotNull(tomcat.getWebappConfigFile("test/deployment/dirContext", "")); + Assert.assertNotNull(tomcat.getWebappConfigFile("test/deployment/dirContext", "")); } @Test public void testGetWebappConfigFileFromDirectoryNegative() { Tomcat tomcat = new Tomcat(); - assertNull(tomcat.getWebappConfigFile("test/deployment/dirNoContext", "")); + Assert.assertNull(tomcat.getWebappConfigFile("test/deployment/dirNoContext", "")); } @Test public void testGetWebappConfigFileFromJar() { Tomcat tomcat = new Tomcat(); - assertNotNull(tomcat.getWebappConfigFile("test/deployment/context.war", "")); + Assert.assertNotNull(tomcat.getWebappConfigFile("test/deployment/context.war", "")); } @Test public void testGetWebappConfigFileFromJarNegative() { Tomcat tomcat = new Tomcat(); - assertNull(tomcat.getWebappConfigFile("test/deployment/noContext.war", "")); + Assert.assertNull(tomcat.getWebappConfigFile("test/deployment/noContext.war", "")); } @Test @@ -426,7 +420,7 @@ public class TestTomcat extends TomcatBa tomcat.start(); - assertEquals("WAR_CONTEXT", context.getSessionCookieName()); + Assert.assertEquals("WAR_CONTEXT", context.getSessionCookieName()); } @Test @@ -437,7 +431,7 @@ public class TestTomcat extends TomcatBa Context context = tomcat.addWebapp(null, "/test", appFile.getAbsolutePath()); - assertEquals(StandardContext.class.getName(), context.getClass() + Assert.assertEquals(StandardContext.class.getName(), context.getClass() .getName()); } @@ -452,7 +446,7 @@ public class TestTomcat extends TomcatBa try { File appFile = new File("test/deployment/context.war"); tomcat.addWebapp(null, "/test", appFile.getAbsolutePath()); - fail(); + Assert.fail(); } catch (IllegalArgumentException e) { // OK } @@ -471,7 +465,7 @@ public class TestTomcat extends TomcatBa Context context = tomcat.addWebapp(null, "/test", appFile.getAbsolutePath()); - assertEquals(ReplicatedContext.class.getName(), context.getClass() + Assert.assertEquals(ReplicatedContext.class.getName(), context.getClass() .getName()); } @@ -488,7 +482,7 @@ public class TestTomcat extends TomcatBa Context context = tomcat.addWebapp(host, "/test", appFile.getAbsolutePath()); - assertEquals(ReplicatedContext.class.getName(), context.getClass() + Assert.assertEquals(ReplicatedContext.class.getName(), context.getClass() .getName()); } @@ -498,7 +492,7 @@ public class TestTomcat extends TomcatBa // No file system docBase required Context ctx = tomcat.addContext(null, "", null); - assertEquals(StandardContext.class.getName(), ctx.getClass().getName()); + Assert.assertEquals(StandardContext.class.getName(), ctx.getClass().getName()); } @Test @@ -512,7 +506,7 @@ public class TestTomcat extends TomcatBa // No file system docBase required try { tomcat.addContext(null, "", null); - fail(); + Assert.fail(); } catch (IllegalArgumentException e) { // OK } @@ -529,7 +523,7 @@ public class TestTomcat extends TomcatBa // No file system docBase required Context ctx = tomcat.addContext(host, "", null); - assertEquals(ReplicatedContext.class.getName(), ctx.getClass() + Assert.assertEquals(ReplicatedContext.class.getName(), ctx.getClass() .getName()); } Modified: tomcat/trunk/test/org/apache/catalina/startup/TestTomcatClassLoader.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TestTomcatClassLoader.java?rev=1815079&r1=1815078&r2=1815079&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/startup/TestTomcatClassLoader.java (original) +++ tomcat/trunk/test/org/apache/catalina/startup/TestTomcatClassLoader.java Mon Nov 13 10:49:13 2017 @@ -26,8 +26,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; @@ -49,7 +48,7 @@ public class TestTomcatClassLoader exten tomcat.start(); ByteChunk res = getUrl("http://localhost:" + getPort() + "/"); - assertEquals("WEBAPP,SYSTEM,OTHER,", res.toString()); + Assert.assertEquals("WEBAPP,SYSTEM,OTHER,", res.toString()); } @Test @@ -72,7 +71,7 @@ public class TestTomcatClassLoader exten tomcat.start(); ByteChunk res = getUrl("http://localhost:" + getPort() + "/"); - assertEquals("WEBAPP,CUSTOM,SYSTEM,OTHER,", res.toString()); + Assert.assertEquals("WEBAPP,CUSTOM,SYSTEM,OTHER,", res.toString()); } private static final class ClassLoaderReport extends HttpServlet { Modified: tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java?rev=1815079&r1=1815078&r2=1815079&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java (original) +++ tomcat/trunk/test/org/apache/catalina/startup/TomcatBaseTest.java Mon Nov 13 10:49:13 2017 @@ -42,8 +42,6 @@ import javax.servlet.http.HttpServletReq import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import static org.junit.Assert.fail; - import org.junit.After; import org.junit.Assert; import org.junit.Before; @@ -151,7 +149,7 @@ public abstract class TomcatBaseTest ext File appBase = new File(getTemporaryDirectory(), "webapps"); if (!appBase.exists() && !appBase.mkdir()) { - fail("Unable to create appBase for test"); + Assert.fail("Unable to create appBase for test"); } tomcat = new TomcatWithFastSessionIDs(); Modified: tomcat/trunk/test/org/apache/catalina/tribes/group/TestGroupChannelOptionFlag.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/group/TestGroupChannelOptionFlag.java?rev=1815079&r1=1815078&r2=1815079&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/tribes/group/TestGroupChannelOptionFlag.java (original) +++ tomcat/trunk/test/org/apache/catalina/tribes/group/TestGroupChannelOptionFlag.java Mon Nov 13 10:49:13 2017 @@ -16,10 +16,8 @@ */ package org.apache.catalina.tribes.group; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - import org.junit.After; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -62,7 +60,7 @@ public class TestGroupChannelOptionFlag }catch ( ChannelException x ) { if (x.getMessage().contains("option flag conflict")) error = true; } - assertTrue(error); + Assert.assertTrue(error); } @Test @@ -83,7 +81,7 @@ public class TestGroupChannelOptionFlag }catch ( ChannelException x ) { if (x.getMessage().contains("option flag conflict")) error = true; } - assertFalse(error); + Assert.assertFalse(error); } public static class TestInterceptor extends ChannelInterceptorBase { Modified: tomcat/trunk/test/org/apache/catalina/tribes/group/TestGroupChannelSenderConnections.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/group/TestGroupChannelSenderConnections.java?rev=1815079&r1=1815078&r2=1815079&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/tribes/group/TestGroupChannelSenderConnections.java (original) +++ tomcat/trunk/test/org/apache/catalina/tribes/group/TestGroupChannelSenderConnections.java Mon Nov 13 10:49:13 2017 @@ -22,9 +22,8 @@ import java.util.HashMap; import java.util.Random; import java.util.concurrent.atomic.AtomicInteger; -import static org.junit.Assert.fail; - import org.junit.After; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -79,7 +78,7 @@ public class TestGroupChannelSenderConne while ((countReceived = getReceivedMessageCount()) != n) { long time = System.currentTimeMillis(); if ((time - startTime) > sleep) { - fail("Only " + countReceived + " out of " + n + Assert.fail("Only " + countReceived + " out of " + n + " messages have been received in " + (sleep / 1000) + " seconds"); break; Modified: tomcat/trunk/test/org/apache/catalina/tribes/group/TestGroupChannelStartStop.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/group/TestGroupChannelStartStop.java?rev=1815079&r1=1815078&r2=1815079&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/tribes/group/TestGroupChannelStartStop.java (original) +++ tomcat/trunk/test/org/apache/catalina/tribes/group/TestGroupChannelStartStop.java Mon Nov 13 10:49:13 2017 @@ -16,9 +16,8 @@ */ package org.apache.catalina.tribes.group; -import static org.junit.Assert.assertEquals; - import org.junit.After; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -57,7 +56,7 @@ public class TestGroupChannelStartStop { channel.start(Channel.DEFAULT); count++; } catch ( Exception x){x.printStackTrace();} - assertEquals(count,2); + Assert.assertEquals(count,2); channel.stop(Channel.DEFAULT); } @@ -82,7 +81,7 @@ public class TestGroupChannelStartStop { } catch ( Exception x){ // expected } - assertEquals(count,1); + Assert.assertEquals(count,1); channel.stop(Channel.DEFAULT); //double the membership sender count = 0; @@ -97,7 +96,7 @@ public class TestGroupChannelStartStop { } catch ( Exception x){ // expected } - assertEquals(count,1); + Assert.assertEquals(count,1); channel.stop(Channel.DEFAULT); count = 0; @@ -111,7 +110,7 @@ public class TestGroupChannelStartStop { } catch ( Exception x){ // expected } - assertEquals(count,1); + Assert.assertEquals(count,1); channel.stop(Channel.DEFAULT); count = 0; @@ -125,7 +124,7 @@ public class TestGroupChannelStartStop { } catch ( Exception x){ // expected } - assertEquals(count,1); + Assert.assertEquals(count,1); channel.stop(Channel.DEFAULT); } @@ -143,7 +142,7 @@ public class TestGroupChannelStartStop { } catch ( Exception x){ // expected } - assertEquals(count,2); + Assert.assertEquals(count,2); channel.stop(Channel.DEFAULT); } Modified: tomcat/trunk/test/org/apache/catalina/tribes/group/interceptors/TestDomainFilterInterceptor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/group/interceptors/TestDomainFilterInterceptor.java?rev=1815079&r1=1815078&r2=1815079&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/tribes/group/interceptors/TestDomainFilterInterceptor.java (original) +++ tomcat/trunk/test/org/apache/catalina/tribes/group/interceptors/TestDomainFilterInterceptor.java Mon Nov 13 10:49:13 2017 @@ -18,9 +18,8 @@ package org.apache.catalina.tribes.group import java.util.ArrayList; -import static org.junit.Assert.assertEquals; - import org.junit.After; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -77,7 +76,9 @@ public class TestDomainFilterInterceptor for (int i=0; i<threads.length; i++ ) threads[i].start(); for (int i=0; i<threads.length; i++ ) threads[i].join(); System.out.println("All channels started."); - for (int i=listeners.length-1; i>=0; i-- ) assertEquals("Checking member arrival length",0,listeners[i].members.size()); + for (int i=listeners.length-1; i>=0; i-- ) { + Assert.assertEquals("Checking member arrival length",0,listeners[i].members.size()); + } } @After Modified: tomcat/trunk/test/org/apache/catalina/tribes/group/interceptors/TestGzipInterceptor.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/group/interceptors/TestGzipInterceptor.java?rev=1815079&r1=1815078&r2=1815079&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/tribes/group/interceptors/TestGzipInterceptor.java (original) +++ tomcat/trunk/test/org/apache/catalina/tribes/group/interceptors/TestGzipInterceptor.java Mon Nov 13 10:49:13 2017 @@ -21,8 +21,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.List; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; @@ -54,6 +53,6 @@ public class TestGzipInterceptor { Arrays.fill(data, (byte)1); byte[] compress = GzipInterceptor.compress(data); byte[] result = GzipInterceptor.decompress(compress); - assertTrue(Arrays.equals(data, result)); + Assert.assertTrue(Arrays.equals(data, result)); } } Modified: tomcat/trunk/test/org/apache/catalina/tribes/group/interceptors/TestNonBlockingCoordinator.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/tribes/group/interceptors/TestNonBlockingCoordinator.java?rev=1815079&r1=1815078&r2=1815079&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/catalina/tribes/group/interceptors/TestNonBlockingCoordinator.java (original) +++ tomcat/trunk/test/org/apache/catalina/tribes/group/interceptors/TestNonBlockingCoordinator.java Mon Nov 13 10:49:13 2017 @@ -16,9 +16,8 @@ */ package org.apache.catalina.tribes.group.interceptors; -import static org.junit.Assert.assertEquals; - import org.junit.After; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -72,7 +71,7 @@ public class TestNonBlockingCoordinator public void testCoord1() throws Exception { int expectedCount = channels[0].getMembers().length; for (int i = 1; i < CHANNEL_COUNT; i++) { - assertEquals("Message count expected to be equal.", expectedCount, + Assert.assertEquals("Message count expected to be equal.", expectedCount, channels[i].getMembers().length); } Member member = coordinators[0].getCoordinator(); @@ -86,7 +85,7 @@ public class TestNonBlockingCoordinator } } for (int i = 0; i < CHANNEL_COUNT; i++) { - assertEquals(member, coordinators[i].getCoordinator()); + Assert.assertEquals(member, coordinators[i].getCoordinator()); } System.out.println("Coordinator[1] is:" + member); } @@ -114,7 +113,7 @@ public class TestNonBlockingCoordinator member = coordinators[index].getCoordinator(); for (int i = 1; i < CHANNEL_COUNT; i++) { if (i != dead) { - assertEquals(member, coordinators[i].getCoordinator()); + Assert.assertEquals(member, coordinators[i].getCoordinator()); } } System.out.println("Coordinator[2b] is:" + member); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org