Modified: tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestNamingContext.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestNamingContext.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestNamingContext.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestNamingContext.java Mon Nov 13 12:32:26 2017 @@ -5,9 +5,9 @@ * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -33,9 +33,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.assertTrue; - import org.junit.Assert; import org.junit.Test; @@ -58,14 +55,14 @@ public class TestNamingContext extends T public void testLookupNonSingletonResource() throws Exception { doTestLookup(false); } - + public void doTestLookup(boolean useSingletonResource) throws Exception { Tomcat tomcat = getTomcatInstance(); tomcat.enableNaming(); // No file system docBase required StandardContext ctx = (StandardContext) tomcat.addContext("", null); - + // Create the resource ContextResource cr = new ContextResource(); cr.setName("list/foo"); @@ -73,7 +70,7 @@ public class TestNamingContext extends T cr.setProperty("factory", "org.apache.naming.resources.TesterFactory"); cr.setSingleton(useSingletonResource); ctx.getNamingResources().addResource(cr); - + // Map the test Servlet Bug49994Servlet bug49994Servlet = new Bug49994Servlet(); Tomcat.addServlet(ctx, "bug49994Servlet", bug49994Servlet); @@ -82,14 +79,14 @@ public class TestNamingContext extends T tomcat.start(); ByteChunk bc = getUrl("http://localhost:" + getPort() + "/"); - + String expected; if (useSingletonResource) { expected = "EQUAL"; } else { expected = "NOTEQUAL"; } - assertEquals(expected, bc.toString()); + Assert.assertEquals(expected, bc.toString()); } @@ -164,7 +161,7 @@ public class TestNamingContext extends T } String contents = new String(buffer, 0, len, "UTF-8"); - assertEquals(foxText, contents); + Assert.assertEquals(foxText, contents); // Check second alias file = ctx.lookup("/a2/test2.txt"); @@ -181,7 +178,7 @@ public class TestNamingContext extends T } contents = new String(buffer, 0, len, "UTF-8"); - assertEquals(loremIpsum, contents); + Assert.assertEquals(loremIpsum, contents); // Test aliases with spaces around the separators ctx.setAliases(" /a1= " + alternate1.getCanonicalPath() @@ -204,7 +201,7 @@ public class TestNamingContext extends T } contents = new String(buffer, 0, len, "UTF-8"); - assertEquals(foxText, contents); + Assert.assertEquals(foxText, contents); // Check second alias file = ctx.lookup("/a2/test2.txt"); @@ -221,13 +218,13 @@ public class TestNamingContext extends T } contents = new String(buffer, 0, len, "UTF-8"); - assertEquals(loremIpsum, contents); + Assert.assertEquals(loremIpsum, contents); } public static final class Bug49994Servlet extends HttpServlet { private static final long serialVersionUID = 1L; - + @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { @@ -257,14 +254,14 @@ public class TestNamingContext extends T // No file system docBase required StandardContext ctx = (StandardContext) tomcat.addContext("", null); - + // Create the resource ContextResource cr = new ContextResource(); cr.setName("list/foo"); cr.setType("org.apache.naming.resources.TesterObject"); cr.setProperty("factory", "org.apache.naming.resources.TesterFactory"); ctx.getNamingResources().addResource(cr); - + // Map the test Servlet Bug23950Servlet bug23950Servlet = new Bug23950Servlet(); Tomcat.addServlet(ctx, "bug23950Servlet", bug23950Servlet); @@ -273,13 +270,13 @@ public class TestNamingContext extends T tomcat.start(); ByteChunk bc = getUrl("http://localhost:" + getPort() + "/"); - assertEquals("org.apache.naming.resources.TesterObject", bc.toString()); + Assert.assertEquals("org.apache.naming.resources.TesterObject", bc.toString()); } - + public static final class Bug23950Servlet extends HttpServlet { private static final long serialVersionUID = 1L; - + @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { @@ -308,7 +305,7 @@ public class TestNamingContext extends T // No file system docBase required StandardContext ctx = (StandardContext) tomcat.addContext("", null); - + // Create the resource ContextResource cr = new ContextResource(); cr.setName("bug50351"); @@ -316,7 +313,7 @@ public class TestNamingContext extends T cr.setProperty("factory", "org.apache.naming.factory.BeanFactory"); cr.setProperty("foo", "value"); ctx.getNamingResources().addResource(cr); - + // Map the test Servlet Bug50351Servlet bug50351Servlet = new Bug50351Servlet(); Tomcat.addServlet(ctx, "bug50351Servlet", bug50351Servlet); @@ -325,13 +322,13 @@ public class TestNamingContext extends T tomcat.start(); ByteChunk bc = getUrl("http://localhost:" + getPort() + "/"); - assertEquals("value", bc.toString()); + Assert.assertEquals("value", bc.toString()); } public static final class Bug50351Servlet extends HttpServlet { private static final long serialVersionUID = 1L; - + @Override protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { @@ -349,7 +346,7 @@ public class TestNamingContext extends T } } } - + @Test public void testBug51744a() throws Exception { doTestBug51744(true); @@ -367,7 +364,7 @@ public class TestNamingContext extends T // No file system docBase required StandardContext ctx = (StandardContext) tomcat.addContext("", null); - + ctx.setJndiExceptionOnFailedWrite(exceptionOnFailedWrite); // Map the test Servlet @@ -379,10 +376,10 @@ public class TestNamingContext extends T ByteChunk bc = new ByteChunk(); int rc = getUrl("http://localhost:" + getPort() + "/", bc, null); - assertEquals(200, rc); - assertTrue(bc.toString().contains(Bug51744Servlet.EXPECTED)); + Assert.assertEquals(200, rc); + Assert.assertTrue(bc.toString().contains(Bug51744Servlet.EXPECTED)); if (exceptionOnFailedWrite) { - assertTrue(bc.toString().contains(Bug51744Servlet.ERROR_MESSAGE)); + Assert.assertTrue(bc.toString().contains(Bug51744Servlet.ERROR_MESSAGE)); } } @@ -442,8 +439,8 @@ public class TestNamingContext extends T ByteChunk bc = new ByteChunk(); int rc = getUrl("http://localhost:" + getPort() + "/", bc, null); - assertEquals(200, rc); - assertTrue(bc.toString().contains("truetrue")); + Assert.assertEquals(200, rc); + Assert.assertTrue(bc.toString().contains("truetrue")); } public static final class Bug52830Servlet extends HttpServlet {
Modified: tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestProxyDirContext.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestProxyDirContext.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestProxyDirContext.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestProxyDirContext.java Mon Nov 13 12:32:26 2017 @@ -18,8 +18,7 @@ package org.apache.naming.resources; import javax.naming.NameNotFoundException; -import static org.junit.Assert.fail; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.core.StandardContext; @@ -46,7 +45,7 @@ public class TestProxyDirContext extends try { ctx.getResources().lookup("/WEB-INF/web.xml"); - fail(); + Assert.fail(); } catch (final NameNotFoundException e) { // as expected @@ -54,7 +53,7 @@ public class TestProxyDirContext extends Thread.sleep(600); // see ProxyDirContext.cacheTTL try { ctx.getResources().lookup("/WEB-INF/web.xml"); - fail(); + Assert.fail(); } catch (final NameNotFoundException e) { // as expected Modified: tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestWarDirContext.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestWarDirContext.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestWarDirContext.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/naming/resources/TestWarDirContext.java Mon Nov 13 12:32:26 2017 @@ -18,8 +18,7 @@ package org.apache.naming.resources; import java.io.File; -import static org.junit.Assert.assertEquals; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.core.JreMemoryLeakPreventionListener; @@ -59,7 +58,7 @@ public class TestWarDirContext extends T ByteChunk bc = getUrl("http://localhost:" + getPort() + "/test/warDirContext.jsp"); - assertEquals("<p>java.lang.ClassNotFoundException</p>", + Assert.assertEquals("<p>java.lang.ClassNotFoundException</p>", bc.toString()); } @@ -83,13 +82,13 @@ public class TestWarDirContext extends T // Should be found in resources.jar ByteChunk bc = getUrl("http://localhost:" + getPort() + "/test/'singlequote.jsp"); - assertEquals("<p>'singlequote.jsp in resources.jar</p>", + Assert.assertEquals("<p>'singlequote.jsp in resources.jar</p>", bc.toString()); // Should be found in file system bc = getUrl("http://localhost:" + getPort() + "/test/'singlequote2.jsp"); - assertEquals("<p>'singlequote2.jsp in file system</p>", + Assert.assertEquals("<p>'singlequote2.jsp in file system</p>", bc.toString()); } @@ -113,13 +112,13 @@ public class TestWarDirContext extends T // Should be found in resources.jar ByteChunk bc = getUrl("http://localhost:" + getPort() + "/test/'singlequote.jsp"); - assertEquals("<p>'singlequote.jsp in resources.jar</p>", + Assert.assertEquals("<p>'singlequote.jsp in resources.jar</p>", bc.toString()); // Should be found in file system bc = getUrl("http://localhost:" + getPort() + "/test/'singlequote2.jsp"); - assertEquals("<p>'singlequote2.jsp in file system</p>", + Assert.assertEquals("<p>'singlequote2.jsp in file system</p>", bc.toString()); } } Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/buf/TestByteChunk.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/buf/TestByteChunk.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/buf/TestByteChunk.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/buf/TestByteChunk.java Mon Nov 13 12:32:26 2017 @@ -19,9 +19,7 @@ package org.apache.tomcat.util.buf; import java.io.UnsupportedEncodingException; import java.util.Arrays; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Test; /** @@ -34,7 +32,7 @@ public class TestByteChunk { String string = "HTTP/1.1 100 Continue\r\n"; byte[] bytes = ByteChunk.convertToBytes(string); byte[] expected = string.getBytes("ISO-8859-1"); - assertTrue(Arrays.equals(bytes, expected)); + Assert.assertTrue(Arrays.equals(bytes, expected)); } /** @@ -53,23 +51,23 @@ public class TestByteChunk { final int len = bytes.length; // indexOf() does not work outside of 0-127 - assertEquals(5, ByteChunk.findByte(bytes, 0, len, (byte) '\u00a0')); - assertEquals(-1, ByteChunk.indexOf(bytes, 0, len, '\u00a0')); + Assert.assertEquals(5, ByteChunk.findByte(bytes, 0, len, (byte) '\u00a0')); + Assert.assertEquals(-1, ByteChunk.indexOf(bytes, 0, len, '\u00a0')); - assertEquals(0, ByteChunk.findByte(bytes, 0, len, (byte) 'H')); - assertEquals(0, ByteChunk.indexOf(bytes, 0, len, 'H')); + Assert.assertEquals(0, ByteChunk.findByte(bytes, 0, len, (byte) 'H')); + Assert.assertEquals(0, ByteChunk.indexOf(bytes, 0, len, 'H')); - assertEquals(len - 1, ByteChunk.findByte(bytes, 0, len, (byte) 'd')); - assertEquals(len - 1, ByteChunk.indexOf(bytes, 0, len, 'd')); + Assert.assertEquals(len - 1, ByteChunk.findByte(bytes, 0, len, (byte) 'd')); + Assert.assertEquals(len - 1, ByteChunk.indexOf(bytes, 0, len, 'd')); - assertEquals(-1, ByteChunk.findByte(bytes, 0, len, (byte) 'x')); - assertEquals(-1, ByteChunk.indexOf(bytes, 0, len, 'x')); + Assert.assertEquals(-1, ByteChunk.findByte(bytes, 0, len, (byte) 'x')); + Assert.assertEquals(-1, ByteChunk.indexOf(bytes, 0, len, 'x')); - assertEquals(7, ByteChunk.findByte(bytes, 5, len, (byte) 'o')); - assertEquals(7, ByteChunk.indexOf(bytes, 5, len, 'o')); + Assert.assertEquals(7, ByteChunk.findByte(bytes, 5, len, (byte) 'o')); + Assert.assertEquals(7, ByteChunk.indexOf(bytes, 5, len, 'o')); - assertEquals(-1, ByteChunk.findByte(bytes, 2, 5, (byte) 'w')); - assertEquals(-1, ByteChunk.indexOf(bytes, 5, 5, 'w')); + Assert.assertEquals(-1, ByteChunk.findByte(bytes, 2, 5, (byte) 'w')); + Assert.assertEquals(-1, ByteChunk.indexOf(bytes, 5, 5, 'w')); } @Test @@ -80,18 +78,18 @@ public class TestByteChunk { ByteChunk bc = new ByteChunk(); bc.setBytes(bytes, 0, len); - assertEquals(0, bc.indexOf('H', 0)); - assertEquals(6, bc.indexOf('w', 0)); + Assert.assertEquals(0, bc.indexOf('H', 0)); + Assert.assertEquals(6, bc.indexOf('w', 0)); // Does not work outside of 0-127 - assertEquals(-1, bc.indexOf('\u00a0', 0)); + Assert.assertEquals(-1, bc.indexOf('\u00a0', 0)); bc.setBytes(bytes, 6, 5); - assertEquals(1, bc.indexOf('o', 0)); + Assert.assertEquals(1, bc.indexOf('o', 0)); bc.setBytes(bytes, 6, 2); - assertEquals(0, bc.indexOf('w', 0)); - assertEquals(-1, bc.indexOf('d', 0)); + Assert.assertEquals(0, bc.indexOf('w', 0)); + Assert.assertEquals(-1, bc.indexOf('d', 0)); } @Test @@ -102,21 +100,21 @@ public class TestByteChunk { ByteChunk bc = new ByteChunk(); bc.setBytes(bytes, 0, len); - assertEquals(0, bc.indexOf("Hello", 0, "Hello".length(), 0)); - assertEquals(2, bc.indexOf("ll", 0, 2, 0)); - assertEquals(2, bc.indexOf("Hello", 2, 2, 0)); + Assert.assertEquals(0, bc.indexOf("Hello", 0, "Hello".length(), 0)); + Assert.assertEquals(2, bc.indexOf("ll", 0, 2, 0)); + Assert.assertEquals(2, bc.indexOf("Hello", 2, 2, 0)); - assertEquals(7, bc.indexOf("o", 0, 1, 5)); + Assert.assertEquals(7, bc.indexOf("o", 0, 1, 5)); // Does not work outside of 0-127 - assertEquals(-1, bc.indexOf("\u00a0", 0, 1, 0)); + Assert.assertEquals(-1, bc.indexOf("\u00a0", 0, 1, 0)); bc.setBytes(bytes, 6, 5); - assertEquals(1, bc.indexOf("o", 0, 1, 0)); + Assert.assertEquals(1, bc.indexOf("o", 0, 1, 0)); bc.setBytes(bytes, 6, 2); - assertEquals(0, bc.indexOf("wo", 0, 1, 0)); - assertEquals(-1, bc.indexOf("d", 0, 1, 0)); + Assert.assertEquals(0, bc.indexOf("wo", 0, 1, 0)); + Assert.assertEquals(-1, bc.indexOf("d", 0, 1, 0)); } @Test @@ -124,16 +122,16 @@ public class TestByteChunk { byte[] bytes = "Hello\u00a0world".getBytes("ISO-8859-1"); final int len = bytes.length; - assertEquals(0, ByteChunk.findBytes(bytes, 0, len, new byte[] { 'H' })); - assertEquals(5, ByteChunk.findBytes(bytes, 0, len, new byte[] { + Assert.assertEquals(0, ByteChunk.findBytes(bytes, 0, len, new byte[] { 'H' })); + Assert.assertEquals(5, ByteChunk.findBytes(bytes, 0, len, new byte[] { (byte) '\u00a0', 'x' })); - assertEquals(5, ByteChunk.findBytes(bytes, 0, len - 4, new byte[] { + Assert.assertEquals(5, ByteChunk.findBytes(bytes, 0, len - 4, new byte[] { 'x', (byte) '\u00a0' })); - assertEquals(len - 1, ByteChunk.findBytes(bytes, 2, len, new byte[] { + Assert.assertEquals(len - 1, ByteChunk.findBytes(bytes, 2, len, new byte[] { 'x', 'd' })); - assertEquals(1, ByteChunk.findBytes(bytes, 0, len, new byte[] { 'o', + Assert.assertEquals(1, ByteChunk.findBytes(bytes, 0, len, new byte[] { 'o', 'e' })); - assertEquals(-1, ByteChunk.findBytes(bytes, 2, 5, new byte[] { 'w' })); + Assert.assertEquals(-1, ByteChunk.findBytes(bytes, 2, 5, new byte[] { 'w' })); } @Test @@ -142,10 +140,10 @@ public class TestByteChunk { byte[] bytes = "Hello\u00a0world".getBytes("ISO-8859-1"); final int len = bytes.length; - assertEquals(4, ByteChunk.findNotBytes(bytes, 0, len, new byte[] { 'l', + Assert.assertEquals(4, ByteChunk.findNotBytes(bytes, 0, len, new byte[] { 'l', 'e', 'H' })); - assertEquals(-1, ByteChunk.findNotBytes(bytes, 0, len, bytes)); - assertEquals(-1, ByteChunk.findNotBytes(bytes, 2, 3, new byte[] { 'l', + Assert.assertEquals(-1, ByteChunk.findNotBytes(bytes, 0, len, bytes)); + Assert.assertEquals(-1, ByteChunk.findNotBytes(bytes, 2, 3, new byte[] { 'l', 'e', 'H' })); } } Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/buf/TestHexUtils.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/buf/TestHexUtils.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/buf/TestHexUtils.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/buf/TestHexUtils.java Mon Nov 13 12:32:26 2017 @@ -17,8 +17,7 @@ package org.apache.tomcat.util.buf; -import static org.junit.Assert.assertEquals; - +import org.junit.Assert; import org.junit.Test; /** @@ -28,15 +27,15 @@ public class TestHexUtils { @Test public void testGetDec() { - assertEquals(0, HexUtils.getDec('0')); - assertEquals(9, HexUtils.getDec('9')); - assertEquals(10, HexUtils.getDec('a')); - assertEquals(15, HexUtils.getDec('f')); - assertEquals(10, HexUtils.getDec('A')); - assertEquals(15, HexUtils.getDec('F')); - assertEquals(-1, HexUtils.getDec(0)); - assertEquals(-1, HexUtils.getDec('Z')); - assertEquals(-1, HexUtils.getDec(255)); - assertEquals(-1, HexUtils.getDec(-60)); + Assert.assertEquals(0, HexUtils.getDec('0')); + Assert.assertEquals(9, HexUtils.getDec('9')); + Assert.assertEquals(10, HexUtils.getDec('a')); + Assert.assertEquals(15, HexUtils.getDec('f')); + Assert.assertEquals(10, HexUtils.getDec('A')); + Assert.assertEquals(15, HexUtils.getDec('F')); + Assert.assertEquals(-1, HexUtils.getDec(0)); + Assert.assertEquals(-1, HexUtils.getDec('Z')); + Assert.assertEquals(-1, HexUtils.getDec(255)); + Assert.assertEquals(-1, HexUtils.getDec(-60)); } } Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/buf/TestUEncoder.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/buf/TestUEncoder.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/buf/TestUEncoder.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/buf/TestUEncoder.java Mon Nov 13 12:32:26 2017 @@ -19,9 +19,7 @@ package org.apache.tomcat.util.buf; import java.io.IOException; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - +import org.junit.Assert; import org.junit.Test; import org.apache.tomcat.util.buf.UEncoder.SafeCharsSet; @@ -36,17 +34,17 @@ public class TestUEncoder { UEncoder urlEncoder = new UEncoder(); String s = "a/b/c/d+e.class"; - assertTrue(urlEncoder.encodeURL(s, 0, s.length()).equals( + Assert.assertTrue(urlEncoder.encodeURL(s, 0, s.length()).equals( "a%2fb%2fc%2fd%2be.class")); - assertTrue(urlEncoder.encodeURL(s, 2, s.length() - 2).equals( + Assert.assertTrue(urlEncoder.encodeURL(s, 2, s.length() - 2).equals( "b%2fc%2fd%2be.cla")); urlEncoder.addSafeCharacter('+'); - assertTrue(urlEncoder.encodeURL(s, 0, s.length()).equals( + Assert.assertTrue(urlEncoder.encodeURL(s, 0, s.length()).equals( "a%2fb%2fc%2fd+e.class")); s = new String(new char[] { 0xD801, 0xDC01 }); - assertTrue(urlEncoder.encodeURL(s, 0, s.length()) + Assert.assertTrue(urlEncoder.encodeURL(s, 0, s.length()) .equals("%f0%90%90%81")); } @@ -55,20 +53,20 @@ public class TestUEncoder { UEncoder urlEncoder = new UEncoder(SafeCharsSet.WITH_SLASH); String s = "a+b/c/d+e.class"; - assertTrue(urlEncoder.encodeURL(s, 0, s.length()).equals( + Assert.assertTrue(urlEncoder.encodeURL(s, 0, s.length()).equals( "a%2bb/c/d%2be.class")); - assertTrue(urlEncoder.encodeURL(s, 2, s.length() - 2).equals( + Assert.assertTrue(urlEncoder.encodeURL(s, 2, s.length() - 2).equals( "b/c/d%2be.cla")); try { urlEncoder.addSafeCharacter('+'); - fail(); + Assert.fail(); } catch (IllegalStateException e) { // OK } s = new String(new char[] { 0xD801, 0xDC01 }); - assertTrue(urlEncoder.encodeURL(s, 0, s.length()) + Assert.assertTrue(urlEncoder.encodeURL(s, 0, s.length()) .equals("%f0%90%90%81")); } Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowEquals.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowEquals.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowEquals.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowEquals.java Mon Nov 13 12:32:26 2017 @@ -24,8 +24,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; @@ -77,7 +76,7 @@ public class TestCookiesAllowEquals exte disconnect(); reset(); tomcat.stop(); - assertEquals(COOKIE_WITH_EQUALS_1 + COOKIE_WITH_EQUALS_2 + + Assert.assertEquals(COOKIE_WITH_EQUALS_1 + COOKIE_WITH_EQUALS_2 + COOKIE_WITH_EQUALS_3, response); } Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowHttpSeps.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowHttpSeps.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowHttpSeps.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowHttpSeps.java Mon Nov 13 12:32:26 2017 @@ -24,8 +24,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; @@ -73,7 +72,7 @@ public class TestCookiesAllowHttpSeps ex disconnect(); reset(); tomcat.stop(); - assertEquals(COOKIE_WITH_SEPS, response); + Assert.assertEquals(COOKIE_WITH_SEPS, response); } @Override Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowNameOnly.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowNameOnly.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowNameOnly.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesAllowNameOnly.java Mon Nov 13 12:32:26 2017 @@ -24,8 +24,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; @@ -76,7 +75,7 @@ public class TestCookiesAllowNameOnly ex reset(); tomcat.stop(); // Need the extra equals since cookie 1 is just the name - assertEquals(COOKIE_WITH_NAME_ONLY_1 + "=" + + Assert.assertEquals(COOKIE_WITH_NAME_ONLY_1 + "=" + COOKIE_WITH_NAME_ONLY_2, response); } Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesDisallowEquals.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesDisallowEquals.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesDisallowEquals.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestCookiesDisallowEquals.java Mon Nov 13 12:32:26 2017 @@ -24,8 +24,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; @@ -70,7 +69,7 @@ public class TestCookiesDisallowEquals e disconnect(); reset(); tomcat.stop(); - assertEquals(COOKIE_TRUNCATED, response); + Assert.assertEquals(COOKIE_TRUNCATED, response); } @Override Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestMimeHeaders.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestMimeHeaders.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestMimeHeaders.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestMimeHeaders.java Mon Nov 13 12:32:26 2017 @@ -25,10 +25,7 @@ import javax.servlet.ServletRequest; import javax.servlet.ServletResponse; import javax.servlet.http.HttpServlet; -import static org.junit.Assert.assertEquals; -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; @@ -93,19 +90,19 @@ public class TestMimeHeaders extends Tom if (successExpected) { alv.validateAccessLog(1, 200, 0, 3000); // Response 200 - assertTrue("Response line is: " + client.getResponseLine(), + Assert.assertTrue("Response line is: " + client.getResponseLine(), client.getResponseLine() != null && client.isResponse200()); - assertEquals("OK", client.getResponseBody()); + Assert.assertEquals("OK", client.getResponseBody()); } else { alv.validateAccessLog(1, 400, 0, 0); // Connection aborted or response 400 - assertTrue("Response line is: " + client.getResponseLine(), + Assert.assertTrue("Response line is: " + client.getResponseLine(), client.getResponseLine() == null || client.isResponse400()); } int maxHeaderCount = tomcat.getConnector().getMaxHeaderCount(); - assertEquals(expectedMaxHeaderCount, maxHeaderCount); + Assert.assertEquals(expectedMaxHeaderCount, maxHeaderCount); if (maxHeaderCount > 0) { - assertEquals(maxHeaderCount, alv.arraySize); + Assert.assertEquals(maxHeaderCount, alv.arraySize); } else if (maxHeaderCount < 0) { int maxHttpHeaderSize = ((Integer) tomcat.getConnector() .getAttribute("maxHttpHeaderSize")).intValue(); @@ -115,7 +112,7 @@ public class TestMimeHeaders extends Tom while (arraySize < headerCount) { arraySize <<= 1; } - assertEquals(arraySize, alv.arraySize); + Assert.assertEquals(arraySize, alv.arraySize); } } @@ -166,7 +163,7 @@ public class TestMimeHeaders extends Tom headersArrayField.setAccessible(true); arraySize = ((Object[]) headersArrayField.get(mh)).length; } catch (Exception ex) { - assertNull(ex.getMessage(), ex); + Assert.assertNull(ex.getMessage(), ex); } } } Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestParameters.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestParameters.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestParameters.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TestParameters.java Mon Nov 13 12:32:26 2017 @@ -20,13 +20,7 @@ import java.io.UnsupportedEncodingExcept import java.net.URLEncoder; import java.util.Enumeration; -import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -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; public class TestParameters { @@ -78,13 +72,13 @@ public class TestParameters { // Make sure the inner Parameter class behaves correctly @Test public void testInternal() { - assertEquals("foo1=bar1", SIMPLE.toString()); + Assert.assertEquals("foo1=bar1", SIMPLE.toString()); // Note: testing requires that ' ' is encoded as '+', // because that is what browsers will send us. - assertEquals("foo2=bar1&foo2=bar2&foo2=hello+world&foo2=%3F%25%40", + Assert.assertEquals("foo2=bar1&foo2=bar2&foo2=hello+world&foo2=%3F%25%40", SIMPLE_MULTIPLE.toString()); - assertEquals("foo3", NO_VALUE.toString()); - assertEquals("foo4=", EMPTY_VALUE.toString()); + Assert.assertEquals("foo3", NO_VALUE.toString()); + Assert.assertEquals("foo4=", EMPTY_VALUE.toString()); } private long doTestProcessParametersByteArrayIntInt(int limit, @@ -127,13 +121,13 @@ public class TestParameters { Parameters p = new Parameters(); String value = p.getParameter("foo"); - assertNull(value); + Assert.assertNull(value); Enumeration<String> names = p.getParameterNames(); - assertFalse(names.hasMoreElements()); + Assert.assertFalse(names.hasMoreElements()); String[] values = p.getParameterValues("foo"); - assertNull(values); + Assert.assertNull(values); } @@ -143,39 +137,39 @@ public class TestParameters { // Empty at this point Enumeration<String> names = p.getParameterNames(); - assertFalse(names.hasMoreElements()); + Assert.assertFalse(names.hasMoreElements()); String[] values = p.getParameterValues("foo"); - assertNull(values); + Assert.assertNull(values); // Add a parameter with two values p.addParameter("foo", "value1"); p.addParameter("foo", "value2"); names = p.getParameterNames(); - assertTrue(names.hasMoreElements()); - assertEquals("foo", names.nextElement()); - assertFalse(names.hasMoreElements()); + Assert.assertTrue(names.hasMoreElements()); + Assert.assertEquals("foo", names.nextElement()); + Assert.assertFalse(names.hasMoreElements()); values = p.getParameterValues("foo"); - assertEquals(2, values.length); - assertEquals("value1", values[0]); - assertEquals("value2", values[1]); + Assert.assertEquals(2, values.length); + Assert.assertEquals("value1", values[0]); + Assert.assertEquals("value2", values[1]); // Add two more values p.addParameter("foo", "value3"); p.addParameter("foo", "value4"); names = p.getParameterNames(); - assertTrue(names.hasMoreElements()); - assertEquals("foo", names.nextElement()); - assertFalse(names.hasMoreElements()); + Assert.assertTrue(names.hasMoreElements()); + Assert.assertEquals("foo", names.nextElement()); + Assert.assertFalse(names.hasMoreElements()); values = p.getParameterValues("foo"); - assertEquals(4, values.length); - assertEquals("value1", values[0]); - assertEquals("value2", values[1]); - assertEquals("value3", values[2]); - assertEquals("value4", values[3]); + Assert.assertEquals(4, values.length); + Assert.assertEquals("value1", values[0]); + Assert.assertEquals("value2", values[1]); + Assert.assertEquals("value3", values[2]); + Assert.assertEquals("value4", values[3]); } @Test @@ -186,38 +180,38 @@ public class TestParameters { // Empty at this point Enumeration<String> names = p.getParameterNames(); - assertFalse(names.hasMoreElements()); + Assert.assertFalse(names.hasMoreElements()); String[] values = p.getParameterValues("foo1"); - assertNull(values); + Assert.assertNull(values); // Add a parameter p.addParameter("foo1", "value1"); names = p.getParameterNames(); - assertTrue(names.hasMoreElements()); - assertEquals("foo1", names.nextElement()); - assertFalse(names.hasMoreElements()); + Assert.assertTrue(names.hasMoreElements()); + Assert.assertEquals("foo1", names.nextElement()); + Assert.assertFalse(names.hasMoreElements()); values = p.getParameterValues("foo1"); - assertEquals(1, values.length); - assertEquals("value1", values[0]); + Assert.assertEquals(1, values.length); + Assert.assertEquals("value1", values[0]); // Add another parameter p.addParameter("foo2", "value2"); names = p.getParameterNames(); - assertTrue(names.hasMoreElements()); - assertEquals("foo1", names.nextElement()); - assertEquals("foo2", names.nextElement()); - assertFalse(names.hasMoreElements()); + Assert.assertTrue(names.hasMoreElements()); + Assert.assertEquals("foo1", names.nextElement()); + Assert.assertEquals("foo2", names.nextElement()); + Assert.assertFalse(names.hasMoreElements()); values = p.getParameterValues("foo1"); - assertEquals(1, values.length); - assertEquals("value1", values[0]); + Assert.assertEquals(1, values.length); + Assert.assertEquals("value1", values[0]); values = p.getParameterValues("foo2"); - assertEquals(1, values.length); - assertEquals("value2", values[0]); + Assert.assertEquals(1, values.length); + Assert.assertEquals("value2", values[0]); // Add another parameter IllegalStateException e = null; @@ -226,22 +220,22 @@ public class TestParameters { } catch (IllegalStateException ise) { e = ise; } - assertNotNull(e); + Assert.assertNotNull(e); // Check current parameters remain unaffected names = p.getParameterNames(); - assertTrue(names.hasMoreElements()); - assertEquals("foo1", names.nextElement()); - assertEquals("foo2", names.nextElement()); - assertFalse(names.hasMoreElements()); + Assert.assertTrue(names.hasMoreElements()); + Assert.assertEquals("foo1", names.nextElement()); + Assert.assertEquals("foo2", names.nextElement()); + Assert.assertFalse(names.hasMoreElements()); values = p.getParameterValues("foo1"); - assertEquals(1, values.length); - assertEquals("value1", values[0]); + Assert.assertEquals(1, values.length); + Assert.assertEquals("value1", values[0]); values = p.getParameterValues("foo2"); - assertEquals(1, values.length); - assertEquals("value2", values[0]); + Assert.assertEquals(1, values.length); + Assert.assertEquals("value2", values[0]); } @@ -264,14 +258,14 @@ public class TestParameters { match = true; if (parameter.values.length == 0) { // Special case - assertArrayEquals(new String[] {""}, values); + Assert.assertArrayEquals(new String[] {""}, values); } else { - assertArrayEquals(parameter.getValues(), values); + Assert.assertArrayEquals(parameter.getValues(), values); } break; } } - assertTrue(match); + Assert.assertTrue(match); } } Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TesterParametersPerformance.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TesterParametersPerformance.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TesterParametersPerformance.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/TesterParametersPerformance.java Mon Nov 13 12:32:26 2017 @@ -21,7 +21,7 @@ import java.nio.charset.Charset; import java.util.logging.Level; import java.util.logging.LogManager; -import static org.junit.Assert.assertEquals; +import org.junit.Assert; import org.junit.Test; import org.apache.tomcat.util.buf.B2CConverter; @@ -46,7 +46,7 @@ public class TesterParametersPerformance } private long doTestProcessParameters(byte[] input, int size) { - assertEquals(input.length, 3); + Assert.assertEquals(input.length, 3); Parameters p = new Parameters(); Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/mapper/TestMapper.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/mapper/TestMapper.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/mapper/TestMapper.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/mapper/TestMapper.java Mon Nov 13 12:32:26 2017 @@ -20,13 +20,8 @@ import java.util.Arrays; import java.util.Collection; 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; @@ -143,14 +138,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); + Assert.assertEquals("blah7", mapper.hosts[iowPos].object); final int qwigPos = 8; - assertEquals("blah14", mapper.hosts[qwigPos].object); + Assert.assertEquals("blah14", mapper.hosts[qwigPos].object); // Check for alphabetical order of host names String previous; @@ -158,35 +153,35 @@ 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.Host host = mapper.hosts[iowPos]; Mapper.Host 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() Object hostZ = "zzzz"; Object contextZ = "contextZ"; - assertEquals(16, mapper.hosts.length); + Assert.assertEquals(16, mapper.hosts.length); mapper.addContextVersion("zzzz", hostZ, "/", "", contextZ, null, null, null, false, false); - 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()); + 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()); assertSame(contextZ, mapper.hosts[16].contextList.contexts[0].versions[0].object); assertSame(contextZ, @@ -195,32 +190,32 @@ public class TestMapper extends LoggingB @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.Host hostMapping = mapper.hosts[iowPos]; Mapper.Host aliasMapping = mapper.hosts[iowPos + 1]; - assertEquals("iowejoiejfoiew_alias", aliasMapping.name); - assertTrue(aliasMapping.isAlias()); + Assert.assertEquals("iowejoiejfoiew_alias", aliasMapping.name); + Assert.assertTrue(aliasMapping.isAlias()); assertSame(hostMapping.object, aliasMapping.object); - assertEquals("iowejoiejfoiew", hostMapping.getRealHostName()); - assertEquals("iowejoiejfoiew", aliasMapping.getRealHostName()); + Assert.assertEquals("iowejoiejfoiew", hostMapping.getRealHostName()); + Assert.assertEquals("iowejoiejfoiew", aliasMapping.getRealHostName()); assertSame(hostMapping, hostMapping.getRealHost()); 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.Host host : mapper.hosts) { - assertTrue(host.name, !host.name.startsWith("iowejoiejfoiew")); + Assert.assertTrue(host.name, !host.name.startsWith("iowejoiejfoiew")); } } @@ -237,13 +232,13 @@ public class TestMapper extends LoggingB uri.getCharChunk().setLimit(-1); mapper.map(host, uri, null, mappingData); - assertEquals("blah7", mappingData.host); - assertEquals("context2", mappingData.context); - assertEquals("wrapper5", mappingData.wrapper); - 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); + Assert.assertEquals("context2", mappingData.context); + Assert.assertEquals("wrapper5", mappingData.wrapper); + 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(); @@ -251,26 +246,26 @@ public class TestMapper extends LoggingB uri.toChars(); uri.getCharChunk().setLimit(-1); mapper.map(host, uri, null, mappingData); - assertEquals("blah7", mappingData.host); - assertEquals("context3", mappingData.context); - assertEquals("wrapper7", mappingData.wrapper); - 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); + Assert.assertEquals("context3", mappingData.context); + Assert.assertEquals("wrapper7", mappingData.wrapper); + 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); - assertEquals("context3", mappingData.context); - assertEquals("wrapper7", mappingData.wrapper); - 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); + Assert.assertEquals("context3", mappingData.context); + Assert.assertEquals("wrapper7", mappingData.wrapper); + 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 @@ -288,26 +283,26 @@ public class TestMapper extends LoggingB // Verifying configuration created by setUp() Mapper.Host mappedHost = mapper.hosts[iowPos]; - assertEquals(hostName, mappedHost.name); + Assert.assertEquals(hostName, mappedHost.name); Mapper.Context 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); Object oldHost = mappedHost.object; Object oldContext = mappedContext.versions[0].object; - assertEquals("context2", oldContext.toString()); + Assert.assertEquals("context2", oldContext.toString()); Object oldContext1 = mappedHost.contextList.contexts[contextPos - 1].versions[0].object; - assertEquals("context1", oldContext1.toString()); + Assert.assertEquals("context1", oldContext1.toString()); mappingData.recycle(); mapper.map(hostMB, uriMB, null, mappingData); - assertEquals("blah7", mappingData.host.toString()); - assertEquals("context2", mappingData.context.toString()); - assertEquals("wrapper5", mappingData.wrapper.toString()); + Assert.assertEquals("blah7", mappingData.host.toString()); + Assert.assertEquals("context2", mappingData.context.toString()); + Assert.assertEquals("wrapper5", mappingData.wrapper.toString()); mappingData.recycle(); mapperForContext2.map(uriMB, mappingData); - assertEquals("wrapper5", mappingData.wrapper.toString()); + Assert.assertEquals("wrapper5", mappingData.wrapper.toString()); Object newContext = "newContext"; mapper.addContextVersion( @@ -323,34 +318,34 @@ public class TestMapper extends LoggingB 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.toString()); - assertEquals("newContext-default", mappingData.wrapper.toString()); + Assert.assertEquals("newContext", mappingData.context.toString()); + Assert.assertEquals("newContext-default", mappingData.wrapper.toString()); mapper.removeContextVersion(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.toString()); - assertEquals("newContext-default", mappingData.wrapper.toString()); + Assert.assertEquals("newContext", mappingData.context.toString()); + Assert.assertEquals("newContext-default", mappingData.wrapper.toString()); mapper.removeContextVersion(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.toString()); - assertEquals("context1-defaultWrapper", mappingData.wrapper.toString()); + Assert.assertEquals("context1", mappingData.context.toString()); + Assert.assertEquals("context1-defaultWrapper", mappingData.wrapper.toString()); mappingData.recycle(); mapperForContext1.map(uriMB, mappingData); - assertEquals("context1-defaultWrapper", mappingData.wrapper.toString()); + Assert.assertEquals("context1-defaultWrapper", mappingData.wrapper.toString()); mapper.addContextVersion( hostName, @@ -366,13 +361,13 @@ public class TestMapper extends LoggingB 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.toString()); - assertEquals("newContext-defaultWrapper2", mappingData.wrapper.toString()); + Assert.assertEquals("newContext", mappingData.context.toString()); + Assert.assertEquals("newContext-defaultWrapper2", mappingData.wrapper.toString()); } @Test @@ -390,26 +385,26 @@ public class TestMapper extends LoggingB // Verifying configuration created by setUp() Mapper.Host mappedHost = mapper.hosts[iowPos]; - assertEquals(hostName, mappedHost.name); + Assert.assertEquals(hostName, mappedHost.name); Mapper.Context 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); Object oldHost = mappedHost.object; Object oldContext = mappedContext.versions[0].object; - assertEquals("context2", oldContext.toString()); + Assert.assertEquals("context2", oldContext.toString()); Object oldContext1 = mappedHost.contextList.contexts[contextPos - 1].versions[0].object; - assertEquals("context1", oldContext1.toString()); + Assert.assertEquals("context1", oldContext1.toString()); mappingData.recycle(); mapper.map(hostMB, uriMB, null, mappingData); - assertEquals("blah7", mappingData.host.toString()); - assertEquals("context2", mappingData.context.toString()); - assertEquals("wrapper5", mappingData.wrapper.toString()); + Assert.assertEquals("blah7", mappingData.host.toString()); + Assert.assertEquals("context2", mappingData.context.toString()); + Assert.assertEquals("wrapper5", mappingData.wrapper.toString()); mappingData.recycle(); mapperForContext2.map(uriMB, mappingData); - assertEquals("wrapper5", mappingData.wrapper.toString()); + Assert.assertEquals("wrapper5", mappingData.wrapper.toString()); // Mark context as paused // This is what happens when context reload starts @@ -417,10 +412,10 @@ public class TestMapper extends LoggingB mappingData.recycle(); mapper.map(hostMB, uriMB, null, mappingData); - assertEquals("blah7", mappingData.host.toString()); - assertEquals("context2", mappingData.context.toString()); + Assert.assertEquals("blah7", mappingData.host.toString()); + Assert.assertEquals("context2", mappingData.context.toString()); // Wrapper is not mapped for incoming requests if context is paused - assertNull(mappingData.wrapper); + Assert.assertNull(mappingData.wrapper); // Re-add the same context, but different list of wrappers // This is what happens when context reload completes @@ -438,15 +433,15 @@ public class TestMapper extends LoggingB 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.toString()); - assertEquals("context2", mappingData.context.toString()); - assertEquals("newDefaultWrapper", mappingData.wrapper.toString()); + Assert.assertEquals("blah7", mappingData.host.toString()); + Assert.assertEquals("context2", mappingData.context.toString()); + Assert.assertEquals("newDefaultWrapper", mappingData.wrapper.toString()); } @Test @@ -497,24 +492,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()); } } @@ -531,7 +526,7 @@ public class TestMapper extends LoggingB 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/tc7.0.x/trunk/test/org/apache/tomcat/util/http/parser/TestMediaType.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/parser/TestMediaType.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/parser/TestMediaType.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/http/parser/TestMediaType.java Mon Nov 13 12:32:26 2017 @@ -19,10 +19,6 @@ package org.apache.tomcat.util.http.pars import java.io.IOException; import java.io.StringReader; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - import org.junit.Assert; import org.junit.Test; @@ -138,9 +134,9 @@ public class TestMediaType { StringReader sr = new StringReader(sb.toString()); MediaType m = HttpParser.parseMediaType(sr); - assertEquals("foo/bar; charset=UTF-8; a=b", m.toString()); - assertEquals(CHARSET, m.getCharset()); - assertEquals("foo/bar; a=b", m.toStringNoCharset()); + Assert.assertEquals("foo/bar; charset=UTF-8; a=b", m.toString()); + Assert.assertEquals(CHARSET, m.getCharset()); + Assert.assertEquals("foo/bar; a=b", m.toStringNoCharset()); } @@ -153,8 +149,8 @@ public class TestMediaType { StringReader sr = new StringReader(sb.toString()); MediaType m = HttpParser.parseMediaType(sr); - assertEquals(CHARSET_WS, m.getCharset()); - assertEquals(TYPES.replaceAll(" ", ""), + Assert.assertEquals(CHARSET_WS, m.getCharset()); + Assert.assertEquals(TYPES.replaceAll(" ", ""), m.toStringNoCharset()); } @@ -169,23 +165,23 @@ public class TestMediaType { MediaType m = HttpParser.parseMediaType(sr); // Check the types - assertEquals("multipart", m.getType()); - assertEquals("related", m.getSubtype()); + Assert.assertEquals("multipart", m.getType()); + Assert.assertEquals("related", m.getSubtype()); // Check the parameters - assertTrue(m.getParameterCount() == 3); + Assert.assertTrue(m.getParameterCount() == 3); - assertEquals("1_4F50BD36_CDF8C28", m.getParameterValue("boundary")); - assertEquals("\"<31671603.smil>\"", m.getParameterValue("Start")); - assertEquals("\"application/smil;charset=UTF-8\"", + Assert.assertEquals("1_4F50BD36_CDF8C28", m.getParameterValue("boundary")); + Assert.assertEquals("\"<31671603.smil>\"", m.getParameterValue("Start")); + Assert.assertEquals("\"application/smil;charset=UTF-8\"", m.getParameterValue("Type")); String expected = "multipart/related; boundary=1_4F50BD36_CDF8C28; " + "start=\"<31671603.smil>\"; " + "type=\"application/smil;charset=UTF-8\""; - assertEquals(expected, m.toString()); - assertEquals(expected, m.toStringNoCharset()); - assertNull(m.getCharset()); + Assert.assertEquals(expected, m.toString()); + Assert.assertEquals(expected, m.toStringNoCharset()); + Assert.assertNull(m.getCharset()); } @@ -197,18 +193,18 @@ public class TestMediaType { MediaType m = HttpParser.parseMediaType(sr); // Check the types - assertEquals("text", m.getType()); - assertEquals("html", m.getSubtype()); + Assert.assertEquals("text", m.getType()); + Assert.assertEquals("html", m.getSubtype()); // Check the parameters - assertTrue(m.getParameterCount() == 2); + Assert.assertTrue(m.getParameterCount() == 2); - assertEquals("", m.getParameterValue("UTF-8")); - assertEquals("UTF-8", m.getCharset()); + Assert.assertEquals("", m.getParameterValue("UTF-8")); + Assert.assertEquals("UTF-8", m.getCharset()); // Note: Invalid input is filtered out - assertEquals("text/html; charset=UTF-8", m.toString()); - assertEquals("UTF-8", m.getCharset()); + Assert.assertEquals("text/html; charset=UTF-8", m.toString()); + Assert.assertEquals("UTF-8", m.getCharset()); } @@ -219,15 +215,15 @@ public class TestMediaType { StringReader sr = new StringReader(input); MediaType m = HttpParser.parseMediaType(sr); - assertEquals("text", m.getType()); - assertEquals("html", m.getSubtype()); + Assert.assertEquals("text", m.getType()); + Assert.assertEquals("html", m.getSubtype()); - assertTrue(m.getParameterCount() == 1); + Assert.assertTrue(m.getParameterCount() == 1); - assertEquals("UTF-8", m.getParameterValue("charset")); - assertEquals("UTF-8", m.getCharset()); + Assert.assertEquals("UTF-8", m.getParameterValue("charset")); + Assert.assertEquals("UTF-8", m.getCharset()); - assertEquals("text/html; charset=UTF-8", m.toString()); + Assert.assertEquals("text/html; charset=UTF-8", m.toString()); } @@ -249,15 +245,15 @@ public class TestMediaType { MediaType m = HttpParser.parseMediaType(sr); // Check all expected parameters are present - assertTrue(m.getParameterCount() == parameters.length); + Assert.assertTrue(m.getParameterCount() == parameters.length); // Check the types - assertEquals(TYPE.trim(), m.getType()); - assertEquals(SUBTYPE.trim(), m.getSubtype()); + Assert.assertEquals(TYPE.trim(), m.getType()); + Assert.assertEquals(SUBTYPE.trim(), m.getSubtype()); // Check the parameters for (int i = 0; i < parameters.length; i++) { - assertEquals(parameters[i].getValue().trim(), + Assert.assertEquals(parameters[i].getValue().trim(), m.getParameterValue(parameters[i].getName().trim())); } } Modified: tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/threads/TestLimitLatch.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/threads/TestLimitLatch.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/threads/TestLimitLatch.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/tomcat/util/threads/TestLimitLatch.java Mon Nov 13 12:32:26 2017 @@ -16,9 +16,7 @@ */ package org.apache.tomcat.util.threads; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; - +import org.junit.Assert; import org.junit.Test; public class TestLimitLatch { @@ -26,70 +24,70 @@ public class TestLimitLatch { @Test public void testNoThreads() throws Exception { LimitLatch latch = new LimitLatch(0); - assertFalse("No threads should be waiting", latch.hasQueuedThreads()); + Assert.assertFalse("No threads should be waiting", latch.hasQueuedThreads()); } @Test public void testOneThreadNoWait() throws Exception { LimitLatch latch = new LimitLatch(1); - assertFalse("No threads should be waiting", latch.hasQueuedThreads()); + Assert.assertFalse("No threads should be waiting", latch.hasQueuedThreads()); Thread testThread = new TestThread(latch); testThread.start(); Thread.sleep(50); - assertEquals("0 threads should be waiting", 0, + Assert.assertEquals("0 threads should be waiting", 0, latch.getQueuedThreads().size()); latch.countUpOrAwait(); Thread.sleep(50); - assertFalse("No threads should be waiting", latch.hasQueuedThreads()); + Assert.assertFalse("No threads should be waiting", latch.hasQueuedThreads()); } @Test public void testOneThreadWaitCountUp() throws Exception { LimitLatch latch = new LimitLatch(1); - assertFalse("No threads should be waiting", latch.hasQueuedThreads()); + Assert.assertFalse("No threads should be waiting", latch.hasQueuedThreads()); Thread testThread = new TestThread(latch); latch.countUpOrAwait(); testThread.start(); Thread.sleep(50); - assertEquals("1 threads should be waiting", 1, + Assert.assertEquals("1 threads should be waiting", 1, latch.getQueuedThreads().size()); latch.countDown(); Thread.sleep(50); - assertFalse("No threads should be waiting", latch.hasQueuedThreads()); + Assert.assertFalse("No threads should be waiting", latch.hasQueuedThreads()); } @Test public void testOneRelease() throws Exception { LimitLatch latch = new LimitLatch(1); - assertFalse("No threads should be waiting", latch.hasQueuedThreads()); + Assert.assertFalse("No threads should be waiting", latch.hasQueuedThreads()); Thread testThread = new TestThread(latch); latch.countUpOrAwait(); testThread.start(); Thread.sleep(50); - assertEquals("1 threads should be waiting", 1, + Assert.assertEquals("1 threads should be waiting", 1, latch.getQueuedThreads().size()); latch.releaseAll(); Thread.sleep(50); - assertFalse("No threads should be waiting", latch.hasQueuedThreads()); + Assert.assertFalse("No threads should be waiting", latch.hasQueuedThreads()); } @Test public void testTenWait() throws Exception { LimitLatch latch = new LimitLatch(10); - assertFalse("No threads should be waiting", latch.hasQueuedThreads()); + Assert.assertFalse("No threads should be waiting", latch.hasQueuedThreads()); Thread[] testThread = new TestThread[30]; for (int i = 0; i < 30; i++) { testThread[i] = new TestThread(latch, 1000); testThread[i].start(); } Thread.sleep(50); - assertEquals("20 threads should be waiting", 20, + Assert.assertEquals("20 threads should be waiting", 20, latch.getQueuedThreads().size()); Thread.sleep(1000); - assertEquals("10 threads should be waiting", 10, + Assert.assertEquals("10 threads should be waiting", 10, latch.getQueuedThreads().size()); Thread.sleep(1000); - assertFalse("No threads should be waiting", latch.hasQueuedThreads()); + Assert.assertFalse("No threads should be waiting", latch.hasQueuedThreads()); } private static class TestThread extends Thread { --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org