Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/tribes/test/channel/TestRemoteProcessException.java Mon Nov 13 12:32:26 2017 @@ -21,10 +21,8 @@ import java.io.Serializable; import java.util.Arrays; import java.util.Random; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - import org.junit.After; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -81,7 +79,7 @@ public class TestRemoteProcessException Channel.SEND_OPTIONS_SYNCHRONIZED_ACK | Channel.SEND_OPTIONS_USE_ACK); if (error) { - fail("A ChannelException was expected"); + Assert.fail("A ChannelException was expected"); } } catch (ChannelException e) { if (!error) { @@ -96,10 +94,10 @@ public class TestRemoteProcessException // as it is being re-sent. Thus the listener1 count is off by +2. final int duplicate = 2; - assertEquals("Checking failure messages.", errC + duplicate, + Assert.assertEquals("Checking failure messages.", errC + duplicate, listener1.errCnt); - assertEquals("Checking success messages.", nerrC, listener1.noErrCnt); - assertEquals("Checking all messages.", msgCount + duplicate, + Assert.assertEquals("Checking success messages.", nerrC, listener1.noErrCnt); + Assert.assertEquals("Checking all messages.", msgCount + duplicate, listener1.noErrCnt + listener1.errCnt); System.out.println("Listener 1 stats:"); listener1.printStats(System.out);
Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/tribes/test/channel/TestUdpPackages.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/tribes/test/channel/TestUdpPackages.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/catalina/tribes/test/channel/TestUdpPackages.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/tribes/test/channel/TestUdpPackages.java Mon Nov 13 12:32:26 2017 @@ -22,9 +22,8 @@ import java.util.Random; import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; -import static org.junit.Assert.assertEquals; - import org.junit.After; +import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -91,7 +90,7 @@ public class TestUdpPackages { channel1.send(new Member[] {channel2.getLocalMember(false)}, Data.createRandomData(1024),Channel.SEND_OPTIONS_UDP); Thread.sleep(500); System.err.println("Finished Single package NO_ACK ["+listener1.count+"]"); - assertEquals("Checking success messages.",1,listener1.count.get()); + Assert.assertEquals("Checking success messages.",1,listener1.count.get()); } @Test @@ -133,7 +132,7 @@ public class TestUdpPackages { System.out.println("Sent "+counter.get()+ " messages. Received "+listener1.count+" Highest msg received:"+listener1.maxIdx); System.out.print("Missing messages:"); printMissingMsgs(listener1.nrs,counter.get()); - assertEquals("Checking success messages.",msgCount*threadCount,listener1.count.get()); + Assert.assertEquals("Checking success messages.",msgCount*threadCount,listener1.count.get()); } public static void printMissingMsgs(int[] msgs, int maxIdx) { @@ -182,7 +181,7 @@ public class TestUdpPackages { System.out.println("Sent "+counter.get()+ " messages. Received "+listener1.count+" Highest msg received:"+listener1.maxIdx); System.out.print("Missing messages:"); printMissingMsgs(listener1.nrs,counter.get()); - assertEquals("Checking success messages.",msgCount*threadCount,listener1.count.get()); + Assert.assertEquals("Checking success messages.",msgCount*threadCount,listener1.count.get()); } @Test @@ -193,7 +192,7 @@ public class TestUdpPackages { long start = System.currentTimeMillis(); while ( (System.currentTimeMillis()-start)<5000 && msgCount!=listener1.count.get()) Thread.sleep(500); System.err.println("Finished ASYNC"); - assertEquals("Checking success messages.",msgCount,listener1.count.get()); + Assert.assertEquals("Checking success messages.",msgCount,listener1.count.get()); } @Test @@ -202,7 +201,7 @@ public class TestUdpPackages { for (int i=0; i<msgCount; i++) channel1.send(new Member[] {channel2.getLocalMember(false)},Data.createRandomData(1024),Channel.SEND_OPTIONS_USE_ACK|Channel.SEND_OPTIONS_UDP); Thread.sleep(250); System.err.println("Finished ACK"); - assertEquals("Checking success messages.",msgCount,listener1.count.get()); + Assert.assertEquals("Checking success messages.",msgCount,listener1.count.get()); } @Test @@ -211,7 +210,7 @@ public class TestUdpPackages { for (int i=0; i<msgCount; i++) channel1.send(new Member[] {channel2.getLocalMember(false)},Data.createRandomData(1024),Channel.SEND_OPTIONS_SYNCHRONIZED_ACK|Channel.SEND_OPTIONS_USE_ACK|Channel.SEND_OPTIONS_UDP); Thread.sleep(250); System.err.println("Finished SYNC_ACK"); - assertEquals("Checking success messages.",msgCount,listener1.count.get()); + Assert.assertEquals("Checking success messages.",msgCount,listener1.count.get()); } public static class Listener implements ChannelListener { Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestContextName.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestContextName.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestContextName.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestContextName.java Mon Nov 13 12:32:26 2017 @@ -16,8 +16,7 @@ */ package org.apache.catalina.util; -import static org.junit.Assert.assertEquals; - +import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -75,132 +74,132 @@ public class TestContextName { @Test public void testGetBaseName() { - assertEquals("ROOT", cn1.getBaseName()); - assertEquals("ROOT", cn2.getBaseName()); - assertEquals("ROOT", cn3.getBaseName()); - assertEquals("foo", cn4.getBaseName()); - assertEquals("foo#bar", cn5.getBaseName()); - assertEquals("ROOT##A", cn6.getBaseName()); - assertEquals("ROOT##B", cn7.getBaseName()); - assertEquals("ROOT##C", cn8.getBaseName()); - assertEquals("foo##D", cn9.getBaseName()); - assertEquals("foo#bar##E", cn10.getBaseName()); - assertEquals("ROOT", cn11.getBaseName()); - assertEquals("foo", cn12.getBaseName()); - assertEquals("foo#bar", cn13.getBaseName()); - assertEquals("ROOT##A", cn14.getBaseName()); - assertEquals("foo##D", cn15.getBaseName()); - assertEquals("foo#bar##E", cn16.getBaseName()); - assertEquals("ROOT", cn17.getBaseName()); - assertEquals("ROOT#bar", cn18.getBaseName()); - assertEquals("ROOT#bar##A", cn19.getBaseName()); - assertEquals("ROOT##A", cn20.getBaseName()); - assertEquals("foo.war", cn21.getBaseName()); - assertEquals("foo", cn22.getBaseName()); + Assert.assertEquals("ROOT", cn1.getBaseName()); + Assert.assertEquals("ROOT", cn2.getBaseName()); + Assert.assertEquals("ROOT", cn3.getBaseName()); + Assert.assertEquals("foo", cn4.getBaseName()); + Assert.assertEquals("foo#bar", cn5.getBaseName()); + Assert.assertEquals("ROOT##A", cn6.getBaseName()); + Assert.assertEquals("ROOT##B", cn7.getBaseName()); + Assert.assertEquals("ROOT##C", cn8.getBaseName()); + Assert.assertEquals("foo##D", cn9.getBaseName()); + Assert.assertEquals("foo#bar##E", cn10.getBaseName()); + Assert.assertEquals("ROOT", cn11.getBaseName()); + Assert.assertEquals("foo", cn12.getBaseName()); + Assert.assertEquals("foo#bar", cn13.getBaseName()); + Assert.assertEquals("ROOT##A", cn14.getBaseName()); + Assert.assertEquals("foo##D", cn15.getBaseName()); + Assert.assertEquals("foo#bar##E", cn16.getBaseName()); + Assert.assertEquals("ROOT", cn17.getBaseName()); + Assert.assertEquals("ROOT#bar", cn18.getBaseName()); + Assert.assertEquals("ROOT#bar##A", cn19.getBaseName()); + Assert.assertEquals("ROOT##A", cn20.getBaseName()); + Assert.assertEquals("foo.war", cn21.getBaseName()); + Assert.assertEquals("foo", cn22.getBaseName()); } @Test public void testGetPath() { - assertEquals("", cn1.getPath()); - assertEquals("", cn2.getPath()); - assertEquals("", cn3.getPath()); - assertEquals("/foo", cn4.getPath()); - assertEquals("/foo/bar", cn5.getPath()); - assertEquals("", cn6.getPath()); - assertEquals("", cn7.getPath()); - assertEquals("", cn8.getPath()); - assertEquals("/foo", cn9.getPath()); - assertEquals("/foo/bar", cn10.getPath()); - assertEquals("", cn11.getPath()); - assertEquals("/foo", cn12.getPath()); - assertEquals("/foo/bar", cn13.getPath()); - assertEquals("", cn14.getPath()); - assertEquals("/foo", cn15.getPath()); - assertEquals("/foo/bar", cn16.getPath()); - assertEquals("", cn17.getPath()); - assertEquals("/ROOT/bar", cn18.getPath()); - assertEquals("/ROOT/bar", cn19.getPath()); - assertEquals("", cn20.getPath()); - assertEquals("/foo.war", cn21.getPath()); - assertEquals("/foo", cn22.getPath()); + Assert.assertEquals("", cn1.getPath()); + Assert.assertEquals("", cn2.getPath()); + Assert.assertEquals("", cn3.getPath()); + Assert.assertEquals("/foo", cn4.getPath()); + Assert.assertEquals("/foo/bar", cn5.getPath()); + Assert.assertEquals("", cn6.getPath()); + Assert.assertEquals("", cn7.getPath()); + Assert.assertEquals("", cn8.getPath()); + Assert.assertEquals("/foo", cn9.getPath()); + Assert.assertEquals("/foo/bar", cn10.getPath()); + Assert.assertEquals("", cn11.getPath()); + Assert.assertEquals("/foo", cn12.getPath()); + Assert.assertEquals("/foo/bar", cn13.getPath()); + Assert.assertEquals("", cn14.getPath()); + Assert.assertEquals("/foo", cn15.getPath()); + Assert.assertEquals("/foo/bar", cn16.getPath()); + Assert.assertEquals("", cn17.getPath()); + Assert.assertEquals("/ROOT/bar", cn18.getPath()); + Assert.assertEquals("/ROOT/bar", cn19.getPath()); + Assert.assertEquals("", cn20.getPath()); + Assert.assertEquals("/foo.war", cn21.getPath()); + Assert.assertEquals("/foo", cn22.getPath()); } @Test public void testGetVersion() { - assertEquals("", cn1.getVersion()); - assertEquals("", cn2.getVersion()); - assertEquals("", cn3.getVersion()); - assertEquals("", cn4.getVersion()); - assertEquals("", cn5.getVersion()); - assertEquals("A", cn6.getVersion()); - assertEquals("B", cn7.getVersion()); - assertEquals("C", cn8.getVersion()); - assertEquals("D", cn9.getVersion()); - assertEquals("E", cn10.getVersion()); - assertEquals("", cn11.getVersion()); - assertEquals("", cn12.getVersion()); - assertEquals("", cn13.getVersion()); - assertEquals("A", cn14.getVersion()); - assertEquals("D", cn15.getVersion()); - assertEquals("E", cn16.getVersion()); - assertEquals("", cn17.getVersion()); - assertEquals("", cn18.getVersion()); - assertEquals("A", cn19.getVersion()); - assertEquals("A", cn20.getVersion()); - assertEquals("", cn21.getVersion()); - assertEquals("", cn22.getVersion()); + Assert.assertEquals("", cn1.getVersion()); + Assert.assertEquals("", cn2.getVersion()); + Assert.assertEquals("", cn3.getVersion()); + Assert.assertEquals("", cn4.getVersion()); + Assert.assertEquals("", cn5.getVersion()); + Assert.assertEquals("A", cn6.getVersion()); + Assert.assertEquals("B", cn7.getVersion()); + Assert.assertEquals("C", cn8.getVersion()); + Assert.assertEquals("D", cn9.getVersion()); + Assert.assertEquals("E", cn10.getVersion()); + Assert.assertEquals("", cn11.getVersion()); + Assert.assertEquals("", cn12.getVersion()); + Assert.assertEquals("", cn13.getVersion()); + Assert.assertEquals("A", cn14.getVersion()); + Assert.assertEquals("D", cn15.getVersion()); + Assert.assertEquals("E", cn16.getVersion()); + Assert.assertEquals("", cn17.getVersion()); + Assert.assertEquals("", cn18.getVersion()); + Assert.assertEquals("A", cn19.getVersion()); + Assert.assertEquals("A", cn20.getVersion()); + Assert.assertEquals("", cn21.getVersion()); + Assert.assertEquals("", cn22.getVersion()); } @Test public void testGetName() { - assertEquals("", cn1.getName()); - assertEquals("", cn2.getName()); - assertEquals("", cn3.getName()); - assertEquals("/foo", cn4.getName()); - assertEquals("/foo/bar", cn5.getName()); - assertEquals("##A", cn6.getName()); - assertEquals("##B", cn7.getName()); - assertEquals("##C", cn8.getName()); - assertEquals("/foo##D", cn9.getName()); - assertEquals("/foo/bar##E", cn10.getName()); - assertEquals("", cn11.getName()); - assertEquals("/foo", cn12.getName()); - assertEquals("/foo/bar", cn13.getName()); - assertEquals("##A", cn14.getName()); - assertEquals("/foo##D", cn15.getName()); - assertEquals("/foo/bar##E", cn16.getName()); - assertEquals("", cn17.getName()); - assertEquals("/ROOT/bar", cn18.getName()); - assertEquals("/ROOT/bar##A", cn19.getName()); - assertEquals("##A", cn20.getName()); - assertEquals("/foo.war", cn21.getName()); - assertEquals("/foo", cn22.getName()); + Assert.assertEquals("", cn1.getName()); + Assert.assertEquals("", cn2.getName()); + Assert.assertEquals("", cn3.getName()); + Assert.assertEquals("/foo", cn4.getName()); + Assert.assertEquals("/foo/bar", cn5.getName()); + Assert.assertEquals("##A", cn6.getName()); + Assert.assertEquals("##B", cn7.getName()); + Assert.assertEquals("##C", cn8.getName()); + Assert.assertEquals("/foo##D", cn9.getName()); + Assert.assertEquals("/foo/bar##E", cn10.getName()); + Assert.assertEquals("", cn11.getName()); + Assert.assertEquals("/foo", cn12.getName()); + Assert.assertEquals("/foo/bar", cn13.getName()); + Assert.assertEquals("##A", cn14.getName()); + Assert.assertEquals("/foo##D", cn15.getName()); + Assert.assertEquals("/foo/bar##E", cn16.getName()); + Assert.assertEquals("", cn17.getName()); + Assert.assertEquals("/ROOT/bar", cn18.getName()); + Assert.assertEquals("/ROOT/bar##A", cn19.getName()); + Assert.assertEquals("##A", cn20.getName()); + Assert.assertEquals("/foo.war", cn21.getName()); + Assert.assertEquals("/foo", cn22.getName()); } @Test public void testGetDisplayName() { - assertEquals("/", cn1.getDisplayName()); - assertEquals("/", cn2.getDisplayName()); - assertEquals("/", cn3.getDisplayName()); - assertEquals("/foo", cn4.getDisplayName()); - assertEquals("/foo/bar", cn5.getDisplayName()); - assertEquals("/##A", cn6.getDisplayName()); - assertEquals("/##B", cn7.getDisplayName()); - assertEquals("/##C", cn8.getDisplayName()); - assertEquals("/foo##D", cn9.getDisplayName()); - assertEquals("/foo/bar##E", cn10.getDisplayName()); - assertEquals("/", cn11.getDisplayName()); - assertEquals("/foo", cn12.getDisplayName()); - assertEquals("/foo/bar", cn13.getDisplayName()); - assertEquals("/##A", cn14.getDisplayName()); - assertEquals("/foo##D", cn15.getDisplayName()); - assertEquals("/foo/bar##E", cn16.getDisplayName()); - assertEquals("/", cn17.getDisplayName()); - assertEquals("/ROOT/bar", cn18.getDisplayName()); - assertEquals("/ROOT/bar##A", cn19.getDisplayName()); - assertEquals("/##A", cn20.getDisplayName()); - assertEquals("/foo.war", cn21.getDisplayName()); - assertEquals("/foo", cn22.getDisplayName()); + Assert.assertEquals("/", cn1.getDisplayName()); + Assert.assertEquals("/", cn2.getDisplayName()); + Assert.assertEquals("/", cn3.getDisplayName()); + Assert.assertEquals("/foo", cn4.getDisplayName()); + Assert.assertEquals("/foo/bar", cn5.getDisplayName()); + Assert.assertEquals("/##A", cn6.getDisplayName()); + Assert.assertEquals("/##B", cn7.getDisplayName()); + Assert.assertEquals("/##C", cn8.getDisplayName()); + Assert.assertEquals("/foo##D", cn9.getDisplayName()); + Assert.assertEquals("/foo/bar##E", cn10.getDisplayName()); + Assert.assertEquals("/", cn11.getDisplayName()); + Assert.assertEquals("/foo", cn12.getDisplayName()); + Assert.assertEquals("/foo/bar", cn13.getDisplayName()); + Assert.assertEquals("/##A", cn14.getDisplayName()); + Assert.assertEquals("/foo##D", cn15.getDisplayName()); + Assert.assertEquals("/foo/bar##E", cn16.getDisplayName()); + Assert.assertEquals("/", cn17.getDisplayName()); + Assert.assertEquals("/ROOT/bar", cn18.getDisplayName()); + Assert.assertEquals("/ROOT/bar##A", cn19.getDisplayName()); + Assert.assertEquals("/##A", cn20.getDisplayName()); + Assert.assertEquals("/foo.war", cn21.getDisplayName()); + Assert.assertEquals("/foo", cn22.getDisplayName()); } @Test @@ -236,10 +235,10 @@ public class TestContextName { } private void doCompare(ContextName cn1, ContextName cn2) { - assertEquals(cn1.getBaseName(), cn2.getBaseName()); - assertEquals(cn1.getDisplayName(), cn2.getDisplayName()); - assertEquals(cn1.getName(), cn2.getName()); - assertEquals(cn1.getPath(), cn2.getPath()); - assertEquals(cn1.getVersion(), cn2.getVersion()); + Assert.assertEquals(cn1.getBaseName(), cn2.getBaseName()); + Assert.assertEquals(cn1.getDisplayName(), cn2.getDisplayName()); + Assert.assertEquals(cn1.getName(), cn2.getName()); + Assert.assertEquals(cn1.getPath(), cn2.getPath()); + Assert.assertEquals(cn1.getVersion(), cn2.getVersion()); } } Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestConversions.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestConversions.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestConversions.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestConversions.java Mon Nov 13 12:32:26 2017 @@ -18,19 +18,19 @@ package org.apache.catalina.util; import java.io.IOException; -import static org.junit.Assert.assertEquals; +import org.junit.Assert; import org.junit.Test; public class TestConversions { @Test public void testByteArrayToLong() throws IOException { - assertEquals(0L, Conversions.byteArrayToLong(new byte[] { 0 })); - assertEquals(1L, Conversions.byteArrayToLong(new byte[] { 1 })); - assertEquals(0xFF, Conversions.byteArrayToLong(new byte[] { -1 })); - assertEquals(0xFFFF, + Assert.assertEquals(0L, Conversions.byteArrayToLong(new byte[] { 0 })); + Assert.assertEquals(1L, Conversions.byteArrayToLong(new byte[] { 1 })); + Assert.assertEquals(0xFF, Conversions.byteArrayToLong(new byte[] { -1 })); + Assert.assertEquals(0xFFFF, Conversions.byteArrayToLong(new byte[] { -1, -1 })); - assertEquals(0xFFFFFF, + Assert.assertEquals(0xFFFFFF, Conversions.byteArrayToLong(new byte[] { -1, -1, -1 })); } Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestRequestUtil.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestRequestUtil.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestRequestUtil.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/util/TestRequestUtil.java Mon Nov 13 12:32:26 2017 @@ -16,9 +16,7 @@ */ package org.apache.catalina.util; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Test; public class TestRequestUtil { @@ -32,7 +30,7 @@ public class TestRequestUtil { } catch (Exception e) { exception = e; } - assertTrue(exception instanceof IllegalArgumentException); + Assert.assertTrue(exception instanceof IllegalArgumentException); // Edge case trying to trigger ArrayIndexOutOfBoundsException exception = null; @@ -41,48 +39,48 @@ public class TestRequestUtil { } catch (Exception e) { exception = e; } - assertTrue(exception instanceof IllegalArgumentException); + Assert.assertTrue(exception instanceof IllegalArgumentException); } @Test public void testURLDecodeStringValidIso88591Start() { String result = RequestUtil.URLDecode("%41xxxx", "ISO-8859-1"); - assertEquals("Axxxx", result); + Assert.assertEquals("Axxxx", result); } @Test public void testURLDecodeStringValidIso88591Middle() { String result = RequestUtil.URLDecode("xx%41xx", "ISO-8859-1"); - assertEquals("xxAxx", result); + Assert.assertEquals("xxAxx", result); } @Test public void testURLDecodeStringValidIso88591End() { String result = RequestUtil.URLDecode("xxxx%41", "ISO-8859-1"); - assertEquals("xxxxA", result); + Assert.assertEquals("xxxxA", result); } @Test public void testURLDecodeStringValidUtf8Start() { String result = RequestUtil.URLDecode("%c3%aaxxxx", "UTF-8"); - assertEquals("\u00eaxxxx", result); + Assert.assertEquals("\u00eaxxxx", result); } @Test public void testURLDecodeStringValidUtf8Middle() { String result = RequestUtil.URLDecode("xx%c3%aaxx", "UTF-8"); - assertEquals("xx\u00eaxx", result); + Assert.assertEquals("xx\u00eaxx", result); } @Test public void testURLDecodeStringValidUtf8End() { String result = RequestUtil.URLDecode("xxxx%c3%aa", "UTF-8"); - assertEquals("xxxx\u00ea", result); + Assert.assertEquals("xxxx\u00ea", result); } } Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/valves/TestRemoteIpValve.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/valves/TestRemoteIpValve.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/catalina/valves/TestRemoteIpValve.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/valves/TestRemoteIpValve.java Mon Nov 13 12:32:26 2017 @@ -24,12 +24,6 @@ import java.util.List; import javax.servlet.ServletException; -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; @@ -95,20 +89,20 @@ public class TestRemoteIpValve { public void testListToCommaDelimitedString() { List<String> elements = Arrays.asList("element1", "element2", "element3"); String actual = RemoteIpValve.listToCommaDelimitedString(elements); - assertEquals("element1, element2, element3", actual); + Assert.assertEquals("element1, element2, element3", actual); } @Test public void testListToCommaDelimitedStringEmptyList() { List<String> elements = new ArrayList<String>(); String actual = RemoteIpValve.listToCommaDelimitedString(elements); - assertEquals("", actual); + Assert.assertEquals("", actual); } @Test public void testCommaDelimitedListToStringArrayNullList() { String actual = RemoteIpValve.listToCommaDelimitedString(null); - assertEquals("", actual); + Assert.assertEquals("", actual); } @Test @@ -132,22 +126,22 @@ public class TestRemoteIpValve { // VERIFY String actualXForwardedFor = request.getHeader("x-forwarded-for"); - assertNull("x-forwarded-for must be null", actualXForwardedFor); + Assert.assertNull("x-forwarded-for must be null", actualXForwardedFor); String actualXForwardedBy = request.getHeader("x-forwarded-by"); - assertNull("x-forwarded-by must be null", actualXForwardedBy); + Assert.assertNull("x-forwarded-by must be null", actualXForwardedBy); String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr(); - assertEquals("remoteAddr", "192.168.0.10", actualRemoteAddr); + Assert.assertEquals("remoteAddr", "192.168.0.10", actualRemoteAddr); String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost(); - assertEquals("remoteHost", "remote-host-original-value", actualRemoteHost); + Assert.assertEquals("remoteHost", "remote-host-original-value", actualRemoteHost); String actualPostInvokeRemoteAddr = request.getRemoteAddr(); - assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr); + Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr); String actualPostInvokeRemoteHost = request.getRemoteHost(); - assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost); + Assert.assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost); } @@ -174,22 +168,22 @@ public class TestRemoteIpValve { // VERIFY String actualXForwardedFor = request.getHeader("x-forwarded-for"); - assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor); + Assert.assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor); String actualXForwardedBy = request.getHeader("x-forwarded-by"); - assertEquals("all proxies are trusted, they must appear in x-forwarded-by", "proxy1, proxy2", actualXForwardedBy); + Assert.assertEquals("all proxies are trusted, they must appear in x-forwarded-by", "proxy1, proxy2", actualXForwardedBy); String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr(); - assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); + Assert.assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost(); - assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); + Assert.assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); String actualPostInvokeRemoteAddr = request.getRemoteAddr(); - assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr); + Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr); String actualPostInvokeRemoteHost = request.getRemoteHost(); - assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost); + Assert.assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost); } @Test @@ -216,22 +210,22 @@ public class TestRemoteIpValve { // VERIFY String actualXForwardedFor = request.getHeader("x-forwarded-for"); - assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor); + Assert.assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor); String actualXForwardedBy = request.getHeader("x-forwarded-by"); - assertEquals("all proxies are trusted, they must appear in x-forwarded-by", "proxy1, proxy2", actualXForwardedBy); + Assert.assertEquals("all proxies are trusted, they must appear in x-forwarded-by", "proxy1, proxy2", actualXForwardedBy); String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr(); - assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); + Assert.assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost(); - assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); + Assert.assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); String actualPostInvokeRemoteAddr = request.getRemoteAddr(); - assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr); + Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr); String actualPostInvokeRemoteHost = request.getRemoteHost(); - assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost); + Assert.assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost); } @Test @@ -257,22 +251,22 @@ public class TestRemoteIpValve { // VERIFY String actualXForwardedFor = request.getHeader("x-forwarded-for"); - assertNull("all proxies are internal, x-forwarded-for must be null", actualXForwardedFor); + Assert.assertNull("all proxies are internal, x-forwarded-for must be null", actualXForwardedFor); String actualXForwardedBy = request.getHeader("x-forwarded-by"); - assertNull("all proxies are internal, x-forwarded-by must be null", actualXForwardedBy); + Assert.assertNull("all proxies are internal, x-forwarded-by must be null", actualXForwardedBy); String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr(); - assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); + Assert.assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost(); - assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); + Assert.assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); String actualPostInvokeRemoteAddr = request.getRemoteAddr(); - assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr); + Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr); String actualPostInvokeRemoteHost = request.getRemoteHost(); - assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost); + Assert.assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost); } @Test @@ -300,22 +294,22 @@ public class TestRemoteIpValve { // VERIFY String actualXForwardedFor = request.getHeader("x-forwarded-for"); - assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor); + Assert.assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor); String actualXForwardedBy = request.getHeader("x-forwarded-by"); - assertEquals("all proxies are trusted, they must appear in x-forwarded-by", "proxy1, proxy2", actualXForwardedBy); + Assert.assertEquals("all proxies are trusted, they must appear in x-forwarded-by", "proxy1, proxy2", actualXForwardedBy); String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr(); - assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); + Assert.assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost(); - assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); + Assert.assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); String actualPostInvokeRemoteAddr = request.getRemoteAddr(); - assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr); + Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr); String actualPostInvokeRemoteHost = request.getRemoteHost(); - assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost); + Assert.assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost); } @Test @@ -346,41 +340,41 @@ public class TestRemoteIpValve { // VERIFY // client ip String actualXForwardedFor = request.getHeader("x-forwarded-for"); - assertNull("no intermediate non-trusted proxy, x-forwarded-for must be null", actualXForwardedFor); + Assert.assertNull("no intermediate non-trusted proxy, x-forwarded-for must be null", actualXForwardedFor); String actualXForwardedBy = request.getHeader("x-forwarded-by"); - assertNull("no intermediate trusted proxy", actualXForwardedBy); + Assert.assertNull("no intermediate trusted proxy", actualXForwardedBy); String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr(); - assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); + Assert.assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost(); - assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); + Assert.assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); String actualPostInvokeRemoteAddr = request.getRemoteAddr(); - assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr); + Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr); String actualPostInvokeRemoteHost = request.getRemoteHost(); - assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteHost); + Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteHost); // protocol String actualScheme = remoteAddrAndHostTrackerValve.getScheme(); - assertEquals("x-forwarded-proto says https", "https", actualScheme); + Assert.assertEquals("x-forwarded-proto says https", "https", actualScheme); int actualServerPort = remoteAddrAndHostTrackerValve.getServerPort(); - assertEquals("x-forwarded-proto says https", 443, actualServerPort); + Assert.assertEquals("x-forwarded-proto says https", 443, actualServerPort); boolean actualSecure = remoteAddrAndHostTrackerValve.isSecure(); - assertTrue("x-forwarded-proto says https", actualSecure); + Assert.assertTrue("x-forwarded-proto says https", actualSecure); boolean actualPostInvokeSecure = request.isSecure(); - assertFalse("postInvoke secure", actualPostInvokeSecure); + Assert.assertFalse("postInvoke secure", actualPostInvokeSecure); int actualPostInvokeServerPort = request.getServerPort(); - assertEquals("postInvoke serverPort", 8080, actualPostInvokeServerPort); + Assert.assertEquals("postInvoke serverPort", 8080, actualPostInvokeServerPort); String actualPostInvokeScheme = request.getScheme(); - assertEquals("postInvoke scheme", "http", actualPostInvokeScheme); + Assert.assertEquals("postInvoke scheme", "http", actualPostInvokeScheme); } @Test @@ -411,41 +405,41 @@ public class TestRemoteIpValve { // VERIFY // client ip String actualXForwardedFor = request.getHeader("x-forwarded-for"); - assertNull("no intermediate non-trusted proxy, x-forwarded-for must be null", actualXForwardedFor); + Assert.assertNull("no intermediate non-trusted proxy, x-forwarded-for must be null", actualXForwardedFor); String actualXForwardedBy = request.getHeader("x-forwarded-by"); - assertNull("no intermediate trusted proxy", actualXForwardedBy); + Assert.assertNull("no intermediate trusted proxy", actualXForwardedBy); String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr(); - assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); + Assert.assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost(); - assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); + Assert.assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); String actualPostInvokeRemoteAddr = request.getRemoteAddr(); - assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr); + Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr); String actualPostInvokeRemoteHost = request.getRemoteHost(); - assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteHost); + Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteHost); // protocol String actualScheme = remoteAddrAndHostTrackerValve.getScheme(); - assertEquals("x-forwarded-proto is null", "http", actualScheme); + Assert.assertEquals("x-forwarded-proto is null", "http", actualScheme); int actualServerPort = remoteAddrAndHostTrackerValve.getServerPort(); - assertEquals("x-forwarded-proto is null", 8080, actualServerPort); + Assert.assertEquals("x-forwarded-proto is null", 8080, actualServerPort); boolean actualSecure = remoteAddrAndHostTrackerValve.isSecure(); - assertFalse("x-forwarded-proto is null", actualSecure); + Assert.assertFalse("x-forwarded-proto is null", actualSecure); boolean actualPostInvokeSecure = request.isSecure(); - assertFalse("postInvoke secure", actualPostInvokeSecure); + Assert.assertFalse("postInvoke secure", actualPostInvokeSecure); int actualPostInvokeServerPort = request.getServerPort(); - assertEquals("postInvoke serverPort", 8080, actualPostInvokeServerPort); + Assert.assertEquals("postInvoke serverPort", 8080, actualPostInvokeServerPort); String actualPostInvokeScheme = request.getScheme(); - assertEquals("postInvoke scheme", "http", actualPostInvokeScheme); + Assert.assertEquals("postInvoke scheme", "http", actualPostInvokeScheme); } @Test @@ -476,41 +470,41 @@ public class TestRemoteIpValve { // VERIFY // client ip String actualXForwardedFor = request.getHeader("x-forwarded-for"); - assertNull("no intermediate non-trusted proxy, x-forwarded-for must be null", actualXForwardedFor); + Assert.assertNull("no intermediate non-trusted proxy, x-forwarded-for must be null", actualXForwardedFor); String actualXForwardedBy = request.getHeader("x-forwarded-by"); - assertNull("no intermediate trusted proxy", actualXForwardedBy); + Assert.assertNull("no intermediate trusted proxy", actualXForwardedBy); String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr(); - assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); + Assert.assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost(); - assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); + Assert.assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); String actualPostInvokeRemoteAddr = request.getRemoteAddr(); - assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr); + Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr); String actualPostInvokeRemoteHost = request.getRemoteHost(); - assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteHost); + Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteHost); // protocol String actualScheme = remoteAddrAndHostTrackerValve.getScheme(); - assertEquals("x-forwarded-proto says http", "http", actualScheme); + Assert.assertEquals("x-forwarded-proto says http", "http", actualScheme); int actualServerPort = remoteAddrAndHostTrackerValve.getServerPort(); - assertEquals("x-forwarded-proto says http", 80, actualServerPort); + Assert.assertEquals("x-forwarded-proto says http", 80, actualServerPort); boolean actualSecure = remoteAddrAndHostTrackerValve.isSecure(); - assertFalse("x-forwarded-proto says http", actualSecure); + Assert.assertFalse("x-forwarded-proto says http", actualSecure); boolean actualPostInvokeSecure = request.isSecure(); - assertTrue("postInvoke secure", actualPostInvokeSecure); + Assert.assertTrue("postInvoke secure", actualPostInvokeSecure); int actualPostInvokeServerPort = request.getServerPort(); - assertEquals("postInvoke serverPort", 8443, actualPostInvokeServerPort); + Assert.assertEquals("postInvoke serverPort", 8443, actualPostInvokeServerPort); String actualPostInvokeScheme = request.getScheme(); - assertEquals("postInvoke scheme", "https", actualPostInvokeScheme); + Assert.assertEquals("postInvoke scheme", "https", actualPostInvokeScheme); } @Test @@ -541,41 +535,41 @@ public class TestRemoteIpValve { // VERIFY // client ip String actualXForwardedFor = request.getHeader("x-forwarded-for"); - assertNull("no intermediate non-trusted proxy, x-forwarded-for must be null", actualXForwardedFor); + Assert.assertNull("no intermediate non-trusted proxy, x-forwarded-for must be null", actualXForwardedFor); String actualXForwardedBy = request.getHeader("x-forwarded-by"); - assertNull("no intermediate trusted proxy", actualXForwardedBy); + Assert.assertNull("no intermediate trusted proxy", actualXForwardedBy); String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr(); - assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); + Assert.assertEquals("remoteAddr", "140.211.11.130", actualRemoteAddr); String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost(); - assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); + Assert.assertEquals("remoteHost", "140.211.11.130", actualRemoteHost); String actualPostInvokeRemoteAddr = request.getRemoteAddr(); - assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr); + Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr); String actualPostInvokeRemoteHost = request.getRemoteHost(); - assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteHost); + Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteHost); // protocol String actualScheme = remoteAddrAndHostTrackerValve.getScheme(); - assertEquals("x-forwarded-proto is null", "https", actualScheme); + Assert.assertEquals("x-forwarded-proto is null", "https", actualScheme); int actualServerPort = remoteAddrAndHostTrackerValve.getServerPort(); - assertEquals("x-forwarded-proto is null", 8443, actualServerPort); + Assert.assertEquals("x-forwarded-proto is null", 8443, actualServerPort); boolean actualSecure = remoteAddrAndHostTrackerValve.isSecure(); - assertTrue("x-forwarded-proto is null", actualSecure); + Assert.assertTrue("x-forwarded-proto is null", actualSecure); boolean actualPostInvokeSecure = request.isSecure(); - assertTrue("postInvoke secure", actualPostInvokeSecure); + Assert.assertTrue("postInvoke secure", actualPostInvokeSecure); int actualPostInvokeServerPort = request.getServerPort(); - assertEquals("postInvoke serverPort", 8443, actualPostInvokeServerPort); + Assert.assertEquals("postInvoke serverPort", 8443, actualPostInvokeServerPort); String actualPostInvokeScheme = request.getScheme(); - assertEquals("postInvoke scheme", "https", actualPostInvokeScheme); + Assert.assertEquals("postInvoke scheme", "https", actualPostInvokeScheme); } @Test @@ -600,22 +594,22 @@ public class TestRemoteIpValve { // VERIFY String actualXForwardedFor = request.getHeader("x-forwarded-for"); - assertEquals("x-forwarded-for must be unchanged", "140.211.11.130, proxy1, proxy2", actualXForwardedFor); + Assert.assertEquals("x-forwarded-for must be unchanged", "140.211.11.130, proxy1, proxy2", actualXForwardedFor); String actualXForwardedBy = request.getHeader("x-forwarded-by"); - assertNull("x-forwarded-by must be null", actualXForwardedBy); + Assert.assertNull("x-forwarded-by must be null", actualXForwardedBy); String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr(); - assertEquals("remoteAddr", "not-allowed-internal-proxy", actualRemoteAddr); + Assert.assertEquals("remoteAddr", "not-allowed-internal-proxy", actualRemoteAddr); String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost(); - assertEquals("remoteHost", "not-allowed-internal-proxy-host", actualRemoteHost); + Assert.assertEquals("remoteHost", "not-allowed-internal-proxy-host", actualRemoteHost); String actualPostInvokeRemoteAddr = request.getRemoteAddr(); - assertEquals("postInvoke remoteAddr", "not-allowed-internal-proxy", actualPostInvokeRemoteAddr); + Assert.assertEquals("postInvoke remoteAddr", "not-allowed-internal-proxy", actualPostInvokeRemoteAddr); String actualPostInvokeRemoteHost = request.getRemoteHost(); - assertEquals("postInvoke remoteAddr", "not-allowed-internal-proxy-host", actualPostInvokeRemoteHost); + Assert.assertEquals("postInvoke remoteAddr", "not-allowed-internal-proxy-host", actualPostInvokeRemoteHost); } @Test @@ -641,22 +635,22 @@ public class TestRemoteIpValve { // VERIFY String actualXForwardedFor = request.getHeader("x-forwarded-for"); - assertEquals("ip/host before untrusted-proxy must appear in x-forwarded-for", "140.211.11.130, proxy1", actualXForwardedFor); + Assert.assertEquals("ip/host before untrusted-proxy must appear in x-forwarded-for", "140.211.11.130, proxy1", actualXForwardedFor); String actualXForwardedBy = request.getHeader("x-forwarded-by"); - assertEquals("ip/host after untrusted-proxy must appear in x-forwarded-by", "proxy2", actualXForwardedBy); + Assert.assertEquals("ip/host after untrusted-proxy must appear in x-forwarded-by", "proxy2", actualXForwardedBy); String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr(); - assertEquals("remoteAddr", "untrusted-proxy", actualRemoteAddr); + Assert.assertEquals("remoteAddr", "untrusted-proxy", actualRemoteAddr); String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost(); - assertEquals("remoteHost", "untrusted-proxy", actualRemoteHost); + Assert.assertEquals("remoteHost", "untrusted-proxy", actualRemoteHost); String actualPostInvokeRemoteAddr = request.getRemoteAddr(); - assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr); + Assert.assertEquals("postInvoke remoteAddr", "192.168.0.10", actualPostInvokeRemoteAddr); String actualPostInvokeRemoteHost = request.getRemoteHost(); - assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost); + Assert.assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost); } @Test @@ -716,19 +710,19 @@ public class TestRemoteIpValve { private void assertArrayEquals(String[] expected, String[] actual) { if (expected == null) { - assertNull(actual); + Assert.assertNull(actual); return; } - assertNotNull(actual); - assertEquals(expected.length, actual.length); + Assert.assertNotNull(actual); + Assert.assertEquals(expected.length, actual.length); List<String> e = new ArrayList<String>(); e.addAll(Arrays.asList(expected)); List<String> a = new ArrayList<String>(); a.addAll(Arrays.asList(actual)); for (String entry : e) { - assertTrue(a.remove(entry)); + Assert.assertTrue(a.remove(entry)); } - assertTrue(a.isEmpty()); + Assert.assertTrue(a.isEmpty()); } } Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/valves/TestRequestFilterValve.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/valves/TestRequestFilterValve.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/catalina/valves/TestRequestFilterValve.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/valves/TestRequestFilterValve.java Mon Nov 13 12:32:26 2017 @@ -21,9 +21,6 @@ import java.io.IOException; import javax.servlet.ServletException; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.fail; - import org.junit.Assert; import org.junit.Test; @@ -134,7 +131,7 @@ public class TestRequestFilterValve { } else if (valve instanceof RemoteHostValve) { ((RemoteHostValve)valve).setAddConnectorPort(true); } else { - fail("Can only set 'addConnectorPort' for RemoteAddrValve and RemoteHostValve"); + Assert.fail("Can only set 'addConnectorPort' for RemoteAddrValve and RemoteHostValve"); } msg.append(" addConnectorPort='true'"); } @@ -155,10 +152,10 @@ public class TestRequestFilterValve { // VERIFY if (!allowed && auth) { - assertEquals(msg.toString(), OK, response.getStatus()); - assertEquals(msg.toString(), "invalid", request.getHeader("authorization")); + Assert.assertEquals(msg.toString(), OK, response.getStatus()); + Assert.assertEquals(msg.toString(), "invalid", request.getHeader("authorization")); } else { - assertEquals(msg.toString(), expected, response.getStatus()); + Assert.assertEquals(msg.toString(), expected, response.getStatus()); } } Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/valves/TesterAccessLogValve.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/valves/TesterAccessLogValve.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/catalina/valves/TesterAccessLogValve.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/valves/TesterAccessLogValve.java Mon Nov 13 12:32:26 2017 @@ -22,8 +22,7 @@ import java.util.concurrent.ConcurrentLi import javax.servlet.ServletException; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; +import org.junit.Assert; import org.apache.catalina.AccessLog; import org.apache.catalina.connector.Request; @@ -77,12 +76,12 @@ public class TesterAccessLogValve extend Thread.sleep(100); } - assertEquals(count, entries.size()); + Assert.assertEquals(count, entries.size()); for (Entry entry : entries) { - assertEquals(status, entry.getStatus()); - assertTrue(entry.toString() + " duration is not >= " + (minTime - ERROR_MARGIN), + Assert.assertEquals(status, entry.getStatus()); + Assert.assertTrue(entry.toString() + " duration is not >= " + (minTime - ERROR_MARGIN), entry.getTime() >= minTime - ERROR_MARGIN); - assertTrue(entry.toString() + " duration is not < " + (maxTime + ERROR_MARGIN), + Assert.assertTrue(entry.toString() + " duration is not < " + (maxTime + ERROR_MARGIN), entry.getTime() < maxTime + ERROR_MARGIN); } } Modified: tomcat/tc7.0.x/trunk/test/org/apache/catalina/websocket/TestWebSocket.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/catalina/websocket/TestWebSocket.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/catalina/websocket/TestWebSocket.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/catalina/websocket/TestWebSocket.java Mon Nov 13 12:32:26 2017 @@ -35,10 +35,6 @@ import javax.naming.InitialContext; import javax.naming.NamingException; import javax.servlet.http.HttpServletRequest; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - import org.junit.Test; import org.apache.catalina.Context; @@ -92,7 +88,7 @@ public class TestWebSocket extends Tomca // Make sure we got an upgrade response String responseLine = client.reader.readLine(); - assertTrue(responseLine.startsWith("HTTP/1.1 101")); + Assert.assertTrue(responseLine.startsWith("HTTP/1.1 101")); // Swallow the headers String responseHeaderLine = client.reader.readLine(); @@ -104,7 +100,7 @@ public class TestWebSocket extends Tomca client.sendMessage("foo", false); client.sendMessage("foo", true); - assertEquals("foofoo", client.readMessage()); + Assert.assertEquals("foofoo", client.readMessage()); // Finished with the socket client.close(); @@ -137,7 +133,7 @@ public class TestWebSocket extends Tomca // Make sure we got an upgrade response String responseLine = client.reader.readLine(); - assertTrue(responseLine.startsWith("HTTP/1.1 426")); + Assert.assertTrue(responseLine.startsWith("HTTP/1.1 426")); List<String> headerlines = new ArrayList<String>(); @@ -147,7 +143,7 @@ public class TestWebSocket extends Tomca responseHeaderLine = client.reader.readLine(); } - assertTrue(headerlines.contains("Sec-WebSocket-Version: 13")); + Assert.assertTrue(headerlines.contains("Sec-WebSocket-Version: 13")); // Finished with the socket client.close(); } @@ -178,7 +174,7 @@ public class TestWebSocket extends Tomca // Make sure we got an error response String responseLine = client.reader.readLine(); - assertTrue(responseLine.startsWith("HTTP/1.1 400")); + Assert.assertTrue(responseLine.startsWith("HTTP/1.1 400")); // Finished with the socket client.close(); @@ -213,7 +209,7 @@ public class TestWebSocket extends Tomca // No upgrade means it is not treated an as upgrade request so a 404 is // generated when the request reaches the Default Servlet.s String responseLine = client.reader.readLine(); - assertTrue(responseLine.startsWith("HTTP/1.1 404")); + Assert.assertTrue(responseLine.startsWith("HTTP/1.1 404")); // Finished with the socket client.close(); @@ -246,7 +242,7 @@ public class TestWebSocket extends Tomca // Make sure we got an upgrade response String responseLine = client.reader.readLine(); - assertTrue(responseLine.startsWith("HTTP/1.1 101")); + Assert.assertTrue(responseLine.startsWith("HTTP/1.1 101")); String accept = null; String responseHeaderLine = client.reader.readLine(); @@ -257,17 +253,17 @@ public class TestWebSocket extends Tomca } responseHeaderLine = client.reader.readLine(); } - assertTrue(accept != null); + Assert.assertTrue(accept != null); MessageDigest sha1Helper = MessageDigest.getInstance("SHA1"); sha1Helper.reset(); sha1Helper.update("TODO".getBytes(B2CConverter.ISO_8859_1)); String source = Base64.encode(sha1Helper.digest(WS_ACCEPT)); - assertEquals(source,accept); + Assert.assertEquals(source,accept); sha1Helper.reset(); sha1Helper.update("TOD".getBytes(B2CConverter.ISO_8859_1)); source = Base64.encode(sha1Helper.digest(WS_ACCEPT)); - assertFalse(source.equals(accept)); + Assert.assertFalse(source.equals(accept)); // Finished with the socket client.close(); } @@ -307,7 +303,7 @@ public class TestWebSocket extends Tomca // Make sure we got an upgrade response String responseLine = client.reader.readLine(); - assertTrue(responseLine.startsWith("HTTP/1.1 101")); + Assert.assertTrue(responseLine.startsWith("HTTP/1.1 101")); // Swallow the headers String responseHeaderLine = client.reader.readLine(); @@ -317,7 +313,7 @@ public class TestWebSocket extends Tomca // Now we can do WebSocket String msg = client.readMessage(); - assertEquals(Bug53339WsInbound.TEST_MESSAGE, msg); + Assert.assertEquals(Bug53339WsInbound.TEST_MESSAGE, msg); // Finished with the socket client.close(); @@ -407,7 +403,7 @@ public class TestWebSocket extends Tomca c2b.convert(cc, bc); int len = bc.getLength(); - assertTrue(len < 126); + Assert.assertTrue(len < 126); byte first; if (isContinuation) { @@ -444,7 +440,7 @@ public class TestWebSocket extends Tomca // Get payload length int len = reader.read() & 0x7F; - assertTrue(len < 126); + Assert.assertTrue(len < 126); // Read payload reader.setEncoding("UTF-8"); Modified: tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestAbstractHttp11Processor.java Mon Nov 13 12:32:26 2017 @@ -43,11 +43,6 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - import org.junit.Assert; import org.junit.Test; @@ -91,11 +86,11 @@ public class TestAbstractHttp11Processor // Expected response is a 200 response followed by an incomplete chunked // body. - assertTrue(client.isResponse200()); + Assert.assertTrue(client.isResponse200()); // There should not be an end chunk - assertFalse(client.getResponseBody().endsWith("0")); + Assert.assertFalse(client.getResponseBody().endsWith("0")); // The last portion of text should be there - assertTrue(client.getResponseBody().endsWith("line03")); + Assert.assertTrue(client.getResponseBody().endsWith("line03")); } private static class ResponseWithErrorServlet extends HttpServlet { @@ -155,7 +150,7 @@ public class TestAbstractHttp11Processor client.connect(); client.processRequest(); - assertTrue(client.isResponse417()); + Assert.assertTrue(client.isResponse417()); } @@ -184,7 +179,7 @@ public class TestAbstractHttp11Processor client.connect(); client.processRequest(); - assertTrue(client.isResponse501()); + Assert.assertTrue(client.isResponse501()); } @Test @@ -212,7 +207,7 @@ public class TestAbstractHttp11Processor client.connect(); client.processRequest(); - assertTrue(client.isResponse501()); + Assert.assertTrue(client.isResponse501()); } @@ -259,8 +254,8 @@ public class TestAbstractHttp11Processor client.connect(); client.processRequest(); - assertTrue(client.isResponse200()); - assertTrue(client.getResponseBody().contains("test - data")); + Assert.assertTrue(client.isResponse200()); + Assert.assertTrue(client.getResponseBody().contains("test - data")); } @@ -290,8 +285,8 @@ public class TestAbstractHttp11Processor client.connect(); client.processRequest(); - assertTrue(client.isResponse200()); - assertTrue(client.getResponseBody().contains("test - data")); + Assert.assertTrue(client.isResponse200()); + Assert.assertTrue(client.getResponseBody().contains("test - data")); } @@ -320,7 +315,7 @@ public class TestAbstractHttp11Processor client.connect(); client.processRequest(); - assertTrue(client.isResponse501()); + Assert.assertTrue(client.isResponse501()); } @@ -349,7 +344,7 @@ public class TestAbstractHttp11Processor client.connect(); client.processRequest(); - assertTrue(client.isResponse501()); + Assert.assertTrue(client.isResponse501()); } @@ -400,16 +395,16 @@ public class TestAbstractHttp11Processor // Now read the first response client.readResponse(true); - assertFalse(client.isResponse50x()); - assertTrue(client.isResponse200()); - assertEquals("OK", client.getResponseBody()); + Assert.assertFalse(client.isResponse50x()); + Assert.assertTrue(client.isResponse200()); + Assert.assertEquals("OK", client.getResponseBody()); // Read the second response. No need to sleep, read will block until // there is data to process client.readResponse(true); - assertFalse(client.isResponse50x()); - assertTrue(client.isResponse200()); - assertEquals("OK", client.getResponseBody()); + Assert.assertFalse(client.isResponse50x()); + Assert.assertTrue(client.isResponse200()); + Assert.assertEquals("OK", client.getResponseBody()); } @@ -432,11 +427,11 @@ public class TestAbstractHttp11Processor int rc = getUrl("http://localhost:" + getPort() + "/test", responseBody, responseHeaders); - assertEquals(HttpServletResponse.SC_OK, rc); - assertTrue(responseHeaders.containsKey("Transfer-Encoding")); + Assert.assertEquals(HttpServletResponse.SC_OK, rc); + Assert.assertTrue(responseHeaders.containsKey("Transfer-Encoding")); List<String> encodings = responseHeaders.get("Transfer-Encoding"); - assertEquals(1, encodings.size()); - assertEquals("chunked", encodings.get(0)); + Assert.assertEquals(1, encodings.size()); + Assert.assertEquals("chunked", encodings.get(0)); } @Test @@ -461,16 +456,16 @@ public class TestAbstractHttp11Processor int rc = getUrl("http://localhost:" + getPort() + "/test", responseBody, responseHeaders); - assertEquals(HttpServletResponse.SC_OK, rc); + Assert.assertEquals(HttpServletResponse.SC_OK, rc); - assertTrue(responseHeaders.containsKey("Connection")); + Assert.assertTrue(responseHeaders.containsKey("Connection")); List<String> connections = responseHeaders.get("Connection"); - assertEquals(1, connections.size()); - assertEquals("close", connections.get(0)); + Assert.assertEquals(1, connections.size()); + Assert.assertEquals("close", connections.get(0)); - assertFalse(responseHeaders.containsKey("Transfer-Encoding")); + Assert.assertFalse(responseHeaders.containsKey("Transfer-Encoding")); - assertEquals("OK", responseBody.toString()); + Assert.assertEquals("OK", responseBody.toString()); } @Test @@ -501,11 +496,11 @@ public class TestAbstractHttp11Processor int rc = getUrl("http://localhost:" + getPort() + "/test", responseBody, responseHeaders); - assertEquals(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, rc); + Assert.assertEquals(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, rc); if (responseBody.getLength() > 0) { // It will be >0 if the standard error page handlign has been // triggered - assertFalse(responseBody.toString().contains("FAIL")); + Assert.assertFalse(responseBody.toString().contains("FAIL")); } } @@ -756,10 +751,10 @@ public class TestAbstractHttp11Processor public void testBug57621() throws Exception { Tomcat tomcat = getTomcatInstance(); - + // Must have a real docBase - just use temp Context root = tomcat.addContext("", System.getProperty("java.io.tmpdir")); - + Wrapper w = Tomcat.addServlet(root, "Bug57621", new Bug57621Servlet()); w.setAsyncSupported(true); root.addServletMapping("/test", "Bug57621"); @@ -774,14 +769,14 @@ public class TestAbstractHttp11Processor client.connect(); client.doRequest(); - assertTrue(client.getResponseLine(), client.isResponse200()); - assertTrue(client.isResponseBodyOK()); + Assert.assertTrue(client.getResponseLine(), client.isResponse200()); + Assert.assertTrue(client.isResponseBodyOK()); // Do the request again to ensure that the remaining body was swallowed client.resetResponse(); client.processRequest(); - assertTrue(client.isResponse200()); - assertTrue(client.isResponseBodyOK()); + Assert.assertTrue(client.isResponse200()); + Assert.assertTrue(client.isResponseBodyOK()); client.disconnect(); } @@ -929,9 +924,9 @@ public class TestAbstractHttp11Processor int rc = headUrl("http://localhost:" + getPort() + "/test", responseBody, responseHeaders); - assertEquals(HttpServletResponse.SC_OK, rc); - assertEquals(0, responseBody.getLength()); - assertFalse(responseHeaders.containsKey("Content-Length")); + Assert.assertEquals(HttpServletResponse.SC_OK, rc); + Assert.assertEquals(0, responseBody.getLength()); + Assert.assertFalse(responseHeaders.containsKey("Content-Length")); } @@ -1066,10 +1061,10 @@ public class TestAbstractHttp11Processor Map<String,List<String>> responseHeaders = new HashMap<String, List<String>>(); int rc = getUrl("http://localhost:" + getPort() + "/test", responseBody, responseHeaders); - assertEquals(HttpServletResponse.SC_RESET_CONTENT, rc); - assertNotNull(responseHeaders.get("Content-Length")); - assertTrue("0".equals(responseHeaders.get("Content-Length").get(0))); - assertTrue(responseBody.getLength() == 0); + Assert.assertEquals(HttpServletResponse.SC_RESET_CONTENT, rc); + Assert.assertNotNull(responseHeaders.get("Content-Length")); + Assert.assertTrue("0".equals(responseHeaders.get("Content-Length").get(0))); + Assert.assertTrue(responseBody.getLength() == 0); } private static final class Bug61086Servlet extends HttpServlet { Modified: tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestGzipOutputFilter.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestGzipOutputFilter.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestGzipOutputFilter.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestGzipOutputFilter.java Mon Nov 13 12:32:26 2017 @@ -20,8 +20,7 @@ package org.apache.coyote.http11; import java.io.ByteArrayOutputStream; import java.util.zip.GZIPOutputStream; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Test; import org.apache.coyote.Response; @@ -86,6 +85,6 @@ public class TestGzipOutputFilter { byte[] dataExpected = gbos.toByteArray(); // most of the data should have been flushed out - assertTrue(dataFound.length >= (dataExpected.length - 20)); + Assert.assertTrue(dataFound.length >= (dataExpected.length - 20)); } } Modified: tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestInternalInputBuffer.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestInternalInputBuffer.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestInternalInputBuffer.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/TestInternalInputBuffer.java Mon Nov 13 12:32:26 2017 @@ -26,10 +26,7 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.Context; @@ -50,8 +47,8 @@ public class TestInternalInputBuffer ext Bug48839Client client = new Bug48839Client(); client.doRequest(); - assertTrue(client.isResponse200()); - assertTrue(client.isResponseBodyOK()); + Assert.assertTrue(client.isResponse200()); + Assert.assertTrue(client.isResponseBodyOK()); } @@ -136,9 +133,9 @@ public class TestInternalInputBuffer ext Bug51557Client client = new Bug51557Client("X-Bug51557Valid", "1234"); client.doRequest(); - assertTrue(client.isResponse200()); - assertEquals("1234abcd", client.getResponseBody()); - assertTrue(client.isResponseBodyOK()); + Assert.assertTrue(client.isResponse200()); + Assert.assertEquals("1234abcd", client.getResponseBody()); + Assert.assertTrue(client.isResponseBodyOK()); } @@ -148,7 +145,7 @@ public class TestInternalInputBuffer ext Bug51557Client client = new Bug51557Client("X-Bug51557=Invalid", "1234", true); client.doRequest(); - assertTrue(client.isResponse400()); + Assert.assertTrue(client.isResponse400()); } @@ -158,9 +155,9 @@ public class TestInternalInputBuffer ext Bug51557Client client = new Bug51557Client("X-Bug51557NoColon"); client.doRequest(); - assertTrue(client.isResponse200()); - assertEquals("abcd", client.getResponseBody()); - assertTrue(client.isResponseBodyOK()); + Assert.assertTrue(client.isResponse200()); + Assert.assertEquals("abcd", client.getResponseBody()); + Assert.assertTrue(client.isResponseBodyOK()); } @@ -196,9 +193,9 @@ public class TestInternalInputBuffer ext "foo" + SimpleHttpClient.CRLF + " bar"); client.doRequest(); - assertTrue(client.isResponse200()); - assertEquals("abcd", client.getResponseBody()); - assertTrue(client.isResponseBodyOK()); + Assert.assertTrue(client.isResponse200()); + Assert.assertEquals("abcd", client.getResponseBody()); + Assert.assertTrue(client.isResponseBodyOK()); } @@ -209,9 +206,9 @@ public class TestInternalInputBuffer ext "invalid"); client.doRequest(); - assertTrue(client.isResponse200()); - assertEquals("abcd", client.getResponseBody()); - assertTrue(client.isResponseBodyOK()); + Assert.assertTrue(client.isResponse200()); + Assert.assertEquals("abcd", client.getResponseBody()); + Assert.assertTrue(client.isResponseBodyOK()); } @@ -222,9 +219,9 @@ public class TestInternalInputBuffer ext "invalid"); client.doRequest(); - assertTrue(client.isResponse200()); - assertEquals("abcd", client.getResponseBody()); - assertTrue(client.isResponseBodyOK()); + Assert.assertTrue(client.isResponse200()); + Assert.assertEquals("abcd", client.getResponseBody()); + Assert.assertTrue(client.isResponseBodyOK()); } @@ -233,9 +230,9 @@ public class TestInternalInputBuffer ext new Bug51557Client("X-Bug" + s + "51557", "invalid"); client.doRequest(); - assertTrue(client.isResponse200()); - assertEquals("abcd", client.getResponseBody()); - assertTrue(client.isResponseBodyOK()); + Assert.assertTrue(client.isResponse200()); + Assert.assertEquals("abcd", client.getResponseBody()); + Assert.assertTrue(client.isResponseBodyOK()); } /** @@ -364,8 +361,8 @@ public class TestInternalInputBuffer ext NewLinesClient client = new NewLinesClient(10); client.doRequest(); - assertTrue(client.isResponse200()); - assertTrue(client.isResponseBodyOK()); + Assert.assertTrue(client.isResponse200()); + Assert.assertTrue(client.isResponseBodyOK()); } @@ -382,9 +379,9 @@ public class TestInternalInputBuffer ext // fail and the response won't be read. Exception e = client.doRequest(); if (e == null) { - assertTrue(client.isResponse400()); + Assert.assertTrue(client.isResponse400()); } - assertFalse(client.isResponseBodyOK()); + Assert.assertFalse(client.isResponseBodyOK()); } @@ -458,8 +455,8 @@ public class TestInternalInputBuffer ext Bug54947Client client = new Bug54947Client(); client.doRequest(); - assertTrue(client.isResponse200()); - assertTrue(client.isResponseBodyOK()); + Assert.assertTrue(client.isResponse200()); + Assert.assertTrue(client.isResponseBodyOK()); } @@ -520,8 +517,8 @@ public class TestInternalInputBuffer ext InvalidMethodClient client = new InvalidMethodClient(); client.doRequest(); - assertTrue(client.getResponseLine(), client.isResponse400()); - assertTrue(client.isResponseBodyOK()); + Assert.assertTrue(client.getResponseLine(), client.isResponse400()); + Assert.assertTrue(client.isResponseBodyOK()); } Modified: tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/filters/TestChunkedInputFilter.java Mon Nov 13 12:32:26 2017 @@ -26,11 +26,7 @@ import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.Context; @@ -147,17 +143,17 @@ public class TestChunkedInputFilter exte } if (expectPass) { - assertTrue(client.isResponse200()); - assertEquals("nullnull7TestValue1TestValue2", + Assert.assertTrue(client.isResponse200()); + Assert.assertEquals("nullnull7TestValue1TestValue2", client.getResponseBody()); - assertNull(processException); - assertFalse(servlet.getExceptionDuringRead()); + Assert.assertNull(processException); + Assert.assertFalse(servlet.getExceptionDuringRead()); } else { if (processException == null) { - assertTrue(client.getResponseLine(), client.isResponse500()); + Assert.assertTrue(client.getResponseLine(), client.isResponse500()); } else { // Use fall-back for checking the error occurred - assertTrue(servlet.getExceptionDuringRead()); + Assert.assertTrue(servlet.getExceptionDuringRead()); } } } @@ -201,7 +197,7 @@ public class TestChunkedInputFilter exte client.processRequest(); // Expected to fail because the trailers are longer // than the set limit of 10 bytes - assertTrue(client.isResponse500()); + Assert.assertTrue(client.isResponse500()); } @@ -267,9 +263,9 @@ public class TestChunkedInputFilter exte client.processRequest(); if (ok) { - assertTrue(client.isResponse200()); + Assert.assertTrue(client.isResponse200()); } else { - assertTrue(client.isResponse500()); + Assert.assertTrue(client.isResponse500()); } } @@ -307,7 +303,7 @@ public class TestChunkedInputFilter exte client.connect(); client.processRequest(); - assertEquals("nullnull7nullnull", client.getResponseBody()); + Assert.assertEquals("nullnull7nullnull", client.getResponseBody()); } @Test @@ -411,20 +407,20 @@ public class TestChunkedInputFilter exte } if (expectPass) { if (expectReadWholeBody) { - assertNull(processException); + Assert.assertNull(processException); } if (processException == null) { - assertTrue(client.getResponseLine(), client.isResponse200()); - assertEquals(String.valueOf(expectReadCount), + Assert.assertTrue(client.getResponseLine(), client.isResponse200()); + Assert.assertEquals(String.valueOf(expectReadCount), client.getResponseBody()); } - assertEquals(expectReadCount, servlet.getCountRead()); + Assert.assertEquals(expectReadCount, servlet.getCountRead()); } else { if (processException == null) { - assertTrue(client.getResponseLine(), client.isResponse500()); + Assert.assertTrue(client.getResponseLine(), client.isResponse500()); } - assertEquals(0, servlet.getCountRead()); - assertTrue(servlet.getExceptionDuringRead()); + Assert.assertEquals(0, servlet.getCountRead()); + Assert.assertTrue(servlet.getExceptionDuringRead()); } } Modified: tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/filters/TestFlushableGZIPOutputStream.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/filters/TestFlushableGZIPOutputStream.java?rev=1815093&r1=1815092&r2=1815093&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/filters/TestFlushableGZIPOutputStream.java (original) +++ tomcat/tc7.0.x/trunk/test/org/apache/coyote/http11/filters/TestFlushableGZIPOutputStream.java Mon Nov 13 12:32:26 2017 @@ -28,8 +28,7 @@ import java.util.List; import java.util.zip.GZIPInputStream; import static org.junit.Assert.assertArrayEquals; -import static org.junit.Assert.assertEquals; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.util.IOTools; @@ -85,7 +84,7 @@ public class TestFlushableGZIPOutputStre originalLength, originalLength + bytes.length)); originalLength += bytes.length; } - assertEquals(originalLength, decompressedBytes.length); + Assert.assertEquals(originalLength, decompressedBytes.length); } /** @@ -123,7 +122,7 @@ public class TestFlushableGZIPOutputStre } byte[] decompressedBytes = sink.toByteArray(); - assertEquals(data.length * 4, decompressedBytes.length); + Assert.assertEquals(data.length * 4, decompressedBytes.length); for (int i = 0; i < 4; i++) { assertArrayEquals(data, Arrays.copyOfRange(decompressedBytes, data.length * i, data.length * (i + 1))); --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org