Author: markt Date: Mon Nov 13 10:09:23 2017 New Revision: 1815069 URL: http://svn.apache.org/viewvc?rev=1815069&view=rev Log: Switch to non-static imports - avoids checkstyle error - broadly the same code volume (or less)
Modified: tomcat/trunk/test/org/apache/tomcat/util/buf/TestByteChunk.java tomcat/trunk/test/org/apache/tomcat/util/buf/TestCharChunk.java tomcat/trunk/test/org/apache/tomcat/util/buf/TestUDecoder.java tomcat/trunk/test/org/apache/tomcat/util/descriptor/web/TestWebRuleSet.java tomcat/trunk/test/org/apache/tomcat/util/http/TestBug49158.java tomcat/trunk/test/org/apache/tomcat/util/http/TestCookiesDefaultSysProps.java tomcat/trunk/test/org/apache/tomcat/util/http/TestCookiesNoFwdStrictSysProps.java tomcat/trunk/test/org/apache/tomcat/util/http/TestCookiesNoStrictNamingSysProps.java tomcat/trunk/test/org/apache/tomcat/util/http/TestCookiesStrictSysProps.java tomcat/trunk/test/org/apache/tomcat/util/http/TestMimeHeadersIntegration.java tomcat/trunk/test/org/apache/tomcat/util/http/TestRequestUtil.java tomcat/trunk/test/org/apache/tomcat/util/net/TestClientCert.java tomcat/trunk/test/org/apache/tomcat/util/net/TestCustomSsl.java tomcat/trunk/test/org/apache/tomcat/util/net/TestSsl.java tomcat/trunk/test/org/apache/tomcat/util/net/TestXxxEndpoint.java tomcat/trunk/test/org/apache/tomcat/util/net/openssl/TestOpenSSLConf.java tomcat/trunk/test/org/apache/tomcat/util/res/TestStringManager.java tomcat/trunk/test/org/apache/tomcat/util/scan/TestJarScanner.java Modified: tomcat/trunk/test/org/apache/tomcat/util/buf/TestByteChunk.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/buf/TestByteChunk.java?rev=1815069&r1=1815068&r2=1815069&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/tomcat/util/buf/TestByteChunk.java (original) +++ tomcat/trunk/test/org/apache/tomcat/util/buf/TestByteChunk.java Mon Nov 13 10:09:23 2017 @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.apache.tomcat.util.buf; import java.io.UnsupportedEncodingException; Modified: tomcat/trunk/test/org/apache/tomcat/util/buf/TestCharChunk.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/buf/TestCharChunk.java?rev=1815069&r1=1815068&r2=1815069&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/tomcat/util/buf/TestCharChunk.java (original) +++ tomcat/trunk/test/org/apache/tomcat/util/buf/TestCharChunk.java Mon Nov 13 10:09:23 2017 @@ -14,12 +14,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.apache.tomcat.util.buf; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Test; /** @@ -30,13 +27,13 @@ public class TestCharChunk { @Test public void testEndsWith() { CharChunk cc = new CharChunk(); - assertFalse(cc.endsWith("test")); + Assert.assertFalse(cc.endsWith("test")); cc.setChars("xxtestxx".toCharArray(), 2, 4); - assertTrue(cc.endsWith("")); - assertTrue(cc.endsWith("t")); - assertTrue(cc.endsWith("st")); - assertTrue(cc.endsWith("test")); - assertFalse(cc.endsWith("x")); - assertFalse(cc.endsWith("xxtest")); + Assert.assertTrue(cc.endsWith("")); + Assert.assertTrue(cc.endsWith("t")); + Assert.assertTrue(cc.endsWith("st")); + Assert.assertTrue(cc.endsWith("test")); + Assert.assertFalse(cc.endsWith("x")); + Assert.assertFalse(cc.endsWith("xxtest")); } } Modified: tomcat/trunk/test/org/apache/tomcat/util/buf/TestUDecoder.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/buf/TestUDecoder.java?rev=1815069&r1=1815068&r2=1815069&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/tomcat/util/buf/TestUDecoder.java (original) +++ tomcat/trunk/test/org/apache/tomcat/util/buf/TestUDecoder.java Mon Nov 13 10:09:23 2017 @@ -18,9 +18,7 @@ package org.apache.tomcat.util.buf; import java.nio.charset.StandardCharsets; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Test; public class TestUDecoder { @@ -34,7 +32,7 @@ public class TestUDecoder { } catch (Exception e) { exception = e; } - assertTrue(exception instanceof IllegalArgumentException); + Assert.assertTrue(exception instanceof IllegalArgumentException); // Edge case trying to trigger ArrayIndexOutOfBoundsException exception = null; @@ -43,62 +41,62 @@ public class TestUDecoder { } catch (Exception e) { exception = e; } - assertTrue(exception instanceof IllegalArgumentException); + Assert.assertTrue(exception instanceof IllegalArgumentException); } @Test public void testURLDecodeStringValidIso88591Start() { String result = UDecoder.URLDecode("%41xxxx", StandardCharsets.ISO_8859_1); - assertEquals("Axxxx", result); + Assert.assertEquals("Axxxx", result); } @Test public void testURLDecodeStringValidIso88591Middle() { String result = UDecoder.URLDecode("xx%41xx", StandardCharsets.ISO_8859_1); - assertEquals("xxAxx", result); + Assert.assertEquals("xxAxx", result); } @Test public void testURLDecodeStringValidIso88591End() { String result = UDecoder.URLDecode("xxxx%41", StandardCharsets.ISO_8859_1); - assertEquals("xxxxA", result); + Assert.assertEquals("xxxxA", result); } @Test public void testURLDecodeStringValidUtf8Start() { String result = UDecoder.URLDecode("%c3%aaxxxx", StandardCharsets.UTF_8); - assertEquals("\u00eaxxxx", result); + Assert.assertEquals("\u00eaxxxx", result); } @Test public void testURLDecodeStringValidUtf8Middle() { String result = UDecoder.URLDecode("xx%c3%aaxx", StandardCharsets.UTF_8); - assertEquals("xx\u00eaxx", result); + Assert.assertEquals("xx\u00eaxx", result); } @Test public void testURLDecodeStringValidUtf8End() { String result = UDecoder.URLDecode("xxxx%c3%aa", StandardCharsets.UTF_8); - assertEquals("xxxx\u00ea", result); + Assert.assertEquals("xxxx\u00ea", result); } @Test public void testURLDecodeStringNonAsciiValidNone() { String result = UDecoder.URLDecode("\u00eaxxxx", StandardCharsets.UTF_8); - assertEquals("\u00eaxxxx", result); + Assert.assertEquals("\u00eaxxxx", result); } @Test public void testURLDecodeStringNonAsciiValidUtf8() { String result = UDecoder.URLDecode("\u00ea%c3%aa", StandardCharsets.UTF_8); - assertEquals("\u00ea\u00ea", result); + Assert.assertEquals("\u00ea\u00ea", result); } } Modified: tomcat/trunk/test/org/apache/tomcat/util/descriptor/web/TestWebRuleSet.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/descriptor/web/TestWebRuleSet.java?rev=1815069&r1=1815068&r2=1815069&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/tomcat/util/descriptor/web/TestWebRuleSet.java (original) +++ tomcat/trunk/test/org/apache/tomcat/util/descriptor/web/TestWebRuleSet.java Mon Nov 13 10:09:23 2017 @@ -20,10 +20,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.InputStream; -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.tomcat.util.digester.Digester; @@ -48,7 +45,7 @@ public class TestWebRuleSet { WebXml webXml = new WebXml(); parse(webXml, "web-fragment-1name.xml", true, true); - assertEquals("name1", webXml.getName()); + Assert.assertEquals("name1", webXml.getName()); } @@ -64,8 +61,8 @@ public class TestWebRuleSet { WebXml webXml = new WebXml(); parse(webXml, "web-fragment-1ordering.xml", true, true); - assertEquals(1, webXml.getBeforeOrdering().size()); - assertTrue(webXml.getBeforeOrdering().contains("bar")); + Assert.assertEquals(1, webXml.getBeforeOrdering().size()); + Assert.assertTrue(webXml.getBeforeOrdering().contains("bar")); } @@ -81,8 +78,8 @@ public class TestWebRuleSet { WebXml webXml = new WebXml(); parse(webXml, "web-1ordering.xml", false, true); - assertEquals(1, webXml.getAbsoluteOrdering().size()); - assertTrue(webXml.getAbsoluteOrdering().contains("bar")); + Assert.assertEquals(1, webXml.getAbsoluteOrdering().size()); + Assert.assertTrue(webXml.getAbsoluteOrdering().contains("bar")); } @@ -150,9 +147,9 @@ public class TestWebRuleSet { } if (expected) { - assertTrue(result); + Assert.assertTrue(result); } else { - assertFalse(result); + Assert.assertFalse(result); } } } Modified: tomcat/trunk/test/org/apache/tomcat/util/http/TestBug49158.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/http/TestBug49158.java?rev=1815069&r1=1815068&r2=1815069&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/tomcat/util/http/TestBug49158.java (original) +++ tomcat/trunk/test/org/apache/tomcat/util/http/TestBug49158.java Mon Nov 13 10:09:23 2017 @@ -14,7 +14,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.apache.tomcat.util.http; import java.io.IOException; @@ -28,8 +27,7 @@ import javax.servlet.http.HttpServletReq import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; -import static org.junit.Assert.assertEquals; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.Context; @@ -55,7 +53,7 @@ public class TestBug49158 extends Cookie ByteChunk res = new ByteChunk(); getUrl("http://localhost:" + getPort() + "/"+path, res, headers); List<String> cookieHeaders = headers.get("Set-Cookie"); - assertEquals("There should only be one Set-Cookie header in this test", + Assert.assertEquals("There should only be one Set-Cookie header in this test", 1, cookieHeaders.size()); } Modified: tomcat/trunk/test/org/apache/tomcat/util/http/TestCookiesDefaultSysProps.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/http/TestCookiesDefaultSysProps.java?rev=1815069&r1=1815068&r2=1815069&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/tomcat/util/http/TestCookiesDefaultSysProps.java (original) +++ tomcat/trunk/test/org/apache/tomcat/util/http/TestCookiesDefaultSysProps.java Mon Nov 13 10:09:23 2017 @@ -20,8 +20,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static org.junit.Assert.assertEquals; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.startup.Tomcat; @@ -47,26 +46,24 @@ public class TestCookiesDefaultSysProps tomcat.start(); ByteChunk res = getUrl("http://localhost:" + getPort() + "/invalid"); - assertEquals("Cookie name fail", res.toString()); + Assert.assertEquals("Cookie name fail", res.toString()); res = getUrl("http://localhost:" + getPort() + "/null"); - assertEquals("Cookie name fail", res.toString()); + Assert.assertEquals("Cookie name fail", res.toString()); res = getUrl("http://localhost:" + getPort() + "/blank"); - assertEquals("Cookie name fail", res.toString()); + Assert.assertEquals("Cookie name fail", res.toString()); res = getUrl("http://localhost:" + getPort() + "/invalidFwd"); - assertEquals("Cookie name fail", res.toString()); + Assert.assertEquals("Cookie name fail", res.toString()); res = getUrl("http://localhost:" + getPort() + "/invalidStrict"); - assertEquals("Cookie name ok", res.toString()); + Assert.assertEquals("Cookie name ok", res.toString()); res = getUrl("http://localhost:" + getPort() + "/valid"); - assertEquals("Cookie name ok", res.toString()); + Assert.assertEquals("Cookie name ok", res.toString()); // Need to read response headers to test version switching Map<String,List<String>> headers = new HashMap<>(); getUrl("http://localhost:" + getPort() + "/switch", res, headers); List<String> cookieHeaders = headers.get("Set-Cookie"); for (String cookieHeader : cookieHeaders) { - assertEquals("name=\"val?ue\"; Version=1", cookieHeader); + Assert.assertEquals("name=\"val?ue\"; Version=1", cookieHeader); } - } - } Modified: tomcat/trunk/test/org/apache/tomcat/util/http/TestCookiesNoFwdStrictSysProps.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/http/TestCookiesNoFwdStrictSysProps.java?rev=1815069&r1=1815068&r2=1815069&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/tomcat/util/http/TestCookiesNoFwdStrictSysProps.java (original) +++ tomcat/trunk/test/org/apache/tomcat/util/http/TestCookiesNoFwdStrictSysProps.java Mon Nov 13 10:09:23 2017 @@ -16,8 +16,7 @@ */ package org.apache.tomcat.util.http; -import static org.junit.Assert.assertEquals; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.startup.Tomcat; @@ -48,18 +47,16 @@ public class TestCookiesNoFwdStrictSysPr tomcat.start(); ByteChunk res = getUrl("http://localhost:" + getPort() + "/invalid"); - assertEquals("Cookie name fail", res.toString()); + Assert.assertEquals("Cookie name fail", res.toString()); res = getUrl("http://localhost:" + getPort() + "/null"); - assertEquals("Cookie name fail", res.toString()); + Assert.assertEquals("Cookie name fail", res.toString()); res = getUrl("http://localhost:" + getPort() + "/blank"); - assertEquals("Cookie name fail", res.toString()); + Assert.assertEquals("Cookie name fail", res.toString()); res = getUrl("http://localhost:" + getPort() + "/invalidFwd"); - assertEquals("Cookie name ok", res.toString()); + Assert.assertEquals("Cookie name ok", res.toString()); res = getUrl("http://localhost:" + getPort() + "/invalidStrict"); - assertEquals("Cookie name fail", res.toString()); + Assert.assertEquals("Cookie name fail", res.toString()); res = getUrl("http://localhost:" + getPort() + "/valid"); - assertEquals("Cookie name ok", res.toString()); - + Assert.assertEquals("Cookie name ok", res.toString()); } - } Modified: tomcat/trunk/test/org/apache/tomcat/util/http/TestCookiesNoStrictNamingSysProps.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/http/TestCookiesNoStrictNamingSysProps.java?rev=1815069&r1=1815068&r2=1815069&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/tomcat/util/http/TestCookiesNoStrictNamingSysProps.java (original) +++ tomcat/trunk/test/org/apache/tomcat/util/http/TestCookiesNoStrictNamingSysProps.java Mon Nov 13 10:09:23 2017 @@ -16,8 +16,7 @@ */ package org.apache.tomcat.util.http; -import static org.junit.Assert.assertEquals; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.startup.Tomcat; @@ -48,17 +47,16 @@ public class TestCookiesNoStrictNamingSy tomcat.start(); ByteChunk res = getUrl("http://localhost:" + getPort() + "/invalid"); - assertEquals("Cookie name fail", res.toString()); + Assert.assertEquals("Cookie name fail", res.toString()); res = getUrl("http://localhost:" + getPort() + "/null"); - assertEquals("Cookie name fail", res.toString()); + Assert.assertEquals("Cookie name fail", res.toString()); res = getUrl("http://localhost:" + getPort() + "/blank"); - assertEquals("Cookie name fail", res.toString()); + Assert.assertEquals("Cookie name fail", res.toString()); res = getUrl("http://localhost:" + getPort() + "/invalidFwd"); - assertEquals("Cookie name fail", res.toString()); + Assert.assertEquals("Cookie name fail", res.toString()); res = getUrl("http://localhost:" + getPort() + "/invalidStrict"); - assertEquals("Cookie name ok", res.toString()); + Assert.assertEquals("Cookie name ok", res.toString()); res = getUrl("http://localhost:" + getPort() + "/valid"); - assertEquals("Cookie name ok", res.toString()); - + Assert.assertEquals("Cookie name ok", res.toString()); } } Modified: tomcat/trunk/test/org/apache/tomcat/util/http/TestCookiesStrictSysProps.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/http/TestCookiesStrictSysProps.java?rev=1815069&r1=1815068&r2=1815069&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/tomcat/util/http/TestCookiesStrictSysProps.java (original) +++ tomcat/trunk/test/org/apache/tomcat/util/http/TestCookiesStrictSysProps.java Mon Nov 13 10:09:23 2017 @@ -20,8 +20,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import static org.junit.Assert.assertEquals; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.startup.Tomcat; @@ -50,26 +49,24 @@ public class TestCookiesStrictSysProps e tomcat.start(); ByteChunk res = getUrl("http://localhost:" + getPort() + "/invalid"); - assertEquals("Cookie name fail", res.toString()); + Assert.assertEquals("Cookie name fail", res.toString()); res = getUrl("http://localhost:" + getPort() + "/null"); - assertEquals("Cookie name fail", res.toString()); + Assert.assertEquals("Cookie name fail", res.toString()); res = getUrl("http://localhost:" + getPort() + "/blank"); - assertEquals("Cookie name fail", res.toString()); + Assert.assertEquals("Cookie name fail", res.toString()); res = getUrl("http://localhost:" + getPort() + "/invalidFwd"); - assertEquals("Cookie name fail", res.toString()); + Assert.assertEquals("Cookie name fail", res.toString()); res = getUrl("http://localhost:" + getPort() + "/invalidStrict"); - assertEquals("Cookie name fail", res.toString()); + Assert.assertEquals("Cookie name fail", res.toString()); res = getUrl("http://localhost:" + getPort() + "/valid"); - assertEquals("Cookie name ok", res.toString()); + Assert.assertEquals("Cookie name ok", res.toString()); // Need to read response headers to test version switching Map<String,List<String>> headers = new HashMap<>(); getUrl("http://localhost:" + getPort() + "/switch", res, headers); List<String> cookieHeaders = headers.get("Set-Cookie"); for (String cookieHeader : cookieHeaders) { - assertEquals("name=\"val?ue\"; Version=1", cookieHeader); + Assert.assertEquals("name=\"val?ue\"; Version=1", cookieHeader); } - } - } Modified: tomcat/trunk/test/org/apache/tomcat/util/http/TestMimeHeadersIntegration.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/http/TestMimeHeadersIntegration.java?rev=1815069&r1=1815068&r2=1815069&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/tomcat/util/http/TestMimeHeadersIntegration.java (original) +++ tomcat/trunk/test/org/apache/tomcat/util/http/TestMimeHeadersIntegration.java Mon Nov 13 10:09:23 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,20 +90,20 @@ public class TestMimeHeadersIntegration 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 = ((Integer) tomcat.getConnector().getProperty("maxHeaderCount")).intValue(); - 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(); @@ -116,7 +113,7 @@ public class TestMimeHeadersIntegration while (arraySize < headerCount) { arraySize <<= 1; } - assertEquals(arraySize, alv.arraySize); + Assert.assertEquals(arraySize, alv.arraySize); } } @@ -167,7 +164,7 @@ public class TestMimeHeadersIntegration headersArrayField.setAccessible(true); arraySize = ((Object[]) headersArrayField.get(mh)).length; } catch (Exception ex) { - assertNull(ex.getMessage(), ex); + Assert.assertNull(ex.getMessage(), ex); } } } Modified: tomcat/trunk/test/org/apache/tomcat/util/http/TestRequestUtil.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/http/TestRequestUtil.java?rev=1815069&r1=1815068&r2=1815069&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/tomcat/util/http/TestRequestUtil.java (original) +++ tomcat/trunk/test/org/apache/tomcat/util/http/TestRequestUtil.java Mon Nov 13 10:09:23 2017 @@ -16,8 +16,7 @@ */ package org.apache.tomcat.util.http; -import static org.junit.Assert.assertEquals; - +import org.junit.Assert; import org.junit.Test; public class TestRequestUtil { @@ -158,6 +157,6 @@ public class TestRequestUtil { } private void doTestNormalize(String input, String expected) { - assertEquals(expected,RequestUtil.normalize(input)); + Assert.assertEquals(expected,RequestUtil.normalize(input)); } } Modified: tomcat/trunk/test/org/apache/tomcat/util/net/TestClientCert.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/net/TestClientCert.java?rev=1815069&r1=1815068&r2=1815069&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/tomcat/util/net/TestClientCert.java (original) +++ tomcat/trunk/test/org/apache/tomcat/util/net/TestClientCert.java Mon Nov 13 10:09:23 2017 @@ -18,9 +18,7 @@ package org.apache.tomcat.util.net; import java.util.Arrays; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Assume; import org.junit.Test; @@ -71,14 +69,14 @@ public class TestClientCert extends Tomc (count > 0 ? TesterSupport.getLastClientAuthRequestedIssuer(0).getName() : "NONE")); log.debug("Expected requested Issuer: " + TesterSupport.getClientAuthExpectedIssuer()); } - assertTrue("Checking requested client issuer against " + - TesterSupport.getClientAuthExpectedIssuer(), - TesterSupport.checkLastClientAuthRequestedIssuers()); + Assert.assertTrue("Checking requested client issuer against " + + TesterSupport.getClientAuthExpectedIssuer(), + TesterSupport.checkLastClientAuthRequestedIssuers()); if (preemptive) { - assertEquals("OK-" + TesterSupport.ROLE, res.toString()); + Assert.assertEquals("OK-" + TesterSupport.ROLE, res.toString()); } else { - assertEquals("OK", res.toString()); + Assert.assertEquals("OK", res.toString()); } // Protected resource @@ -91,11 +89,11 @@ public class TestClientCert extends Tomc (count > 0 ? TesterSupport.getLastClientAuthRequestedIssuer(0).getName() : "NONE")); log.debug("Expected requested Issuer: " + TesterSupport.getClientAuthExpectedIssuer()); } - assertTrue("Checking requested client issuer against " + - TesterSupport.getClientAuthExpectedIssuer(), - TesterSupport.checkLastClientAuthRequestedIssuers()); + Assert.assertTrue("Checking requested client issuer against " + + TesterSupport.getClientAuthExpectedIssuer(), + TesterSupport.checkLastClientAuthRequestedIssuers()); - assertEquals("OK-" + TesterSupport.ROLE, res.toString()); + Assert.assertEquals("OK-" + TesterSupport.ROLE, res.toString()); } @Test @@ -140,11 +138,11 @@ public class TestClientCert extends Tomc (count > 0 ? TesterSupport.getLastClientAuthRequestedIssuer(0).getName() : "NONE")); log.debug("Expected requested Issuer: " + TesterSupport.getClientAuthExpectedIssuer()); } - assertTrue("Checking requested client issuer against " + - TesterSupport.getClientAuthExpectedIssuer(), - TesterSupport.checkLastClientAuthRequestedIssuers()); + Assert.assertTrue("Checking requested client issuer against " + + TesterSupport.getClientAuthExpectedIssuer(), + TesterSupport.checkLastClientAuthRequestedIssuers()); - assertEquals("OK-" + bodySize, res.toString()); + Assert.assertEquals("OK-" + bodySize, res.toString()); // Protected resource res.recycle(); @@ -158,14 +156,14 @@ public class TestClientCert extends Tomc (count > 0 ? TesterSupport.getLastClientAuthRequestedIssuer(0).getName() : "NONE")); log.debug("Expected requested Issuer: " + TesterSupport.getClientAuthExpectedIssuer()); } - assertTrue("Checking requested client issuer against " + - TesterSupport.getClientAuthExpectedIssuer(), - TesterSupport.checkLastClientAuthRequestedIssuers()); + Assert.assertTrue("Checking requested client issuer against " + + TesterSupport.getClientAuthExpectedIssuer(), + TesterSupport.checkLastClientAuthRequestedIssuers()); if (expectProtectedFail) { - assertEquals(401, rc); + Assert.assertEquals(401, rc); } else { - assertEquals("OK-" + bodySize, res.toString()); + Assert.assertEquals("OK-" + bodySize, res.toString()); } } Modified: tomcat/trunk/test/org/apache/tomcat/util/net/TestCustomSsl.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/net/TestCustomSsl.java?rev=1815069&r1=1815068&r2=1815069&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/tomcat/util/net/TestCustomSsl.java (original) +++ tomcat/trunk/test/org/apache/tomcat/util/net/TestCustomSsl.java Mon Nov 13 10:09:23 2017 @@ -21,10 +21,7 @@ import java.net.SocketException; import javax.net.ssl.SSLException; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.junit.Assert.fail; - +import org.junit.Assert; import org.junit.Assume; import org.junit.Test; @@ -88,7 +85,7 @@ public class TestCustomSsl extends Tomca tomcat.start(); ByteChunk res = getUrl("https://localhost:" + getPort() + "/examples/servlets/servlet/HelloWorldExample"); - assertTrue(res.toString().indexOf("<a href=\"../helloworld.html\">") > 0); + Assert.assertTrue(res.toString().indexOf("<a href=\"../helloworld.html\">") > 0); } @Test @@ -122,7 +119,7 @@ public class TestCustomSsl extends Tomca ((AbstractHttp11JsseProtocol<?>) handler).setTruststoreFile(null); } else { // Unexpected - fail("Unexpected handler type"); + Assert.fail("Unexpected handler type"); } if (trustType.equals(TrustType.ALL)) { tomcat.getConnector().setAttribute("trustManagerClassName", @@ -140,7 +137,7 @@ public class TestCustomSsl extends Tomca // Unprotected resource ByteChunk res = getUrl("https://localhost:" + getPort() + "/unprotected"); - assertEquals("OK", res.toString()); + Assert.assertEquals("OK", res.toString()); // Protected resource res.recycle(); @@ -150,12 +147,12 @@ public class TestCustomSsl extends Tomca null, null); } catch (SocketException se) { if (!trustType.equals(TrustType.NONE)) { - fail(se.getMessage()); + Assert.fail(se.getMessage()); se.printStackTrace(); } } catch (SSLException he) { if (!trustType.equals(TrustType.NONE)) { - fail(he.getMessage()); + Assert.fail(he.getMessage()); he.printStackTrace(); } } @@ -168,17 +165,17 @@ public class TestCustomSsl extends Tomca (count > 0 ? TesterSupport.getLastClientAuthRequestedIssuer(0).getName() : "NONE")); log.debug("Expected requested Issuer: " + TesterSupport.getClientAuthExpectedIssuer()); } - assertTrue("Checking requested client issuer against " + - TesterSupport.getClientAuthExpectedIssuer(), - TesterSupport.checkLastClientAuthRequestedIssuers()); + Assert.assertTrue("Checking requested client issuer against " + + TesterSupport.getClientAuthExpectedIssuer(), + TesterSupport.checkLastClientAuthRequestedIssuers()); } if (trustType.equals(TrustType.NONE)) { - assertTrue(rc != 200); - assertEquals("", res.toString()); + Assert.assertTrue(rc != 200); + Assert.assertEquals("", res.toString()); } else { - assertEquals(200, rc); - assertEquals("OK-" + TesterSupport.ROLE, res.toString()); + Assert.assertEquals(200, rc); + Assert.assertEquals("OK-" + TesterSupport.ROLE, res.toString()); } } } Modified: tomcat/trunk/test/org/apache/tomcat/util/net/TestSsl.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/net/TestSsl.java?rev=1815069&r1=1815068&r2=1815069&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/tomcat/util/net/TestSsl.java (original) +++ tomcat/trunk/test/org/apache/tomcat/util/net/TestSsl.java Mon Nov 13 10:09:23 2017 @@ -29,8 +29,6 @@ import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; -import static org.junit.Assert.assertTrue; - import org.junit.Assert; import org.junit.Assume; import org.junit.Test; @@ -66,9 +64,9 @@ public class TestSsl extends TomcatBaseT tomcat.start(); ByteChunk res = getUrl("https://localhost:" + getPort() + "/examples/servlets/servlet/HelloWorldExample"); - assertTrue(res.toString().indexOf("<a href=\"../helloworld.html\">") > 0); - assertTrue("Checking no client issuer has been requested", - TesterSupport.getLastClientAuthRequestedIssuerCount() == 0); + Assert.assertTrue(res.toString().indexOf("<a href=\"../helloworld.html\">") > 0); + Assert. assertTrue("Checking no client issuer has been requested", + TesterSupport.getLastClientAuthRequestedIssuerCount() == 0); } @Test @@ -88,9 +86,9 @@ public class TestSsl extends TomcatBaseT tomcat.start(); ByteChunk res = getUrl("https://localhost:" + getPort() + "/examples/servlets/servlet/HelloWorldExample"); - assertTrue(res.toString().indexOf("<a href=\"../helloworld.html\">") > 0); - assertTrue("Checking no client issuer has been requested", - TesterSupport.getLastClientAuthRequestedIssuerCount() == 0); + Assert.assertTrue(res.toString().indexOf("<a href=\"../helloworld.html\">") > 0); + Assert.assertTrue("Checking no client issuer has been requested", + TesterSupport.getLastClientAuthRequestedIssuerCount() == 0); } @@ -122,8 +120,8 @@ public class TestSsl extends TomcatBaseT Reader r = new InputStreamReader(is); doRequest(os, r); - assertTrue("Checking no client issuer has been requested", - TesterSupport.getLastClientAuthRequestedIssuerCount() == 0); + Assert.assertTrue("Checking no client issuer has been requested", + TesterSupport.getLastClientAuthRequestedIssuerCount() == 0); TesterHandshakeListener listener = new TesterHandshakeListener(); socket.addHandshakeCompletedListener(listener); @@ -137,8 +135,8 @@ public class TestSsl extends TomcatBaseT while (requestCount < 10) { requestCount++; doRequest(os, r); - assertTrue("Checking no client issuer has been requested", - TesterSupport.getLastClientAuthRequestedIssuerCount() == 0); + Assert.assertTrue("Checking no client issuer has been requested", + TesterSupport.getLastClientAuthRequestedIssuerCount() == 0); if (listener.isComplete() && listenerComplete == 0) { listenerComplete = requestCount; } Modified: tomcat/trunk/test/org/apache/tomcat/util/net/TestXxxEndpoint.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/net/TestXxxEndpoint.java?rev=1815069&r1=1815068&r2=1815069&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/tomcat/util/net/TestXxxEndpoint.java (original) +++ tomcat/trunk/test/org/apache/tomcat/util/net/TestXxxEndpoint.java Mon Nov 13 10:09:23 2017 @@ -14,17 +14,13 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.apache.tomcat.util.net; import java.io.File; import java.net.InetAddress; import java.net.ServerSocket; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.connector.Connector; @@ -130,9 +126,9 @@ public class TestXxxEndpoint extends Tom // This should throw an Exception if (isApr) { pool = createAprPool(); - assertTrue(pool != 0); + Assert.assertTrue(pool != 0); nativeSocket = createAprSocket(port, pool); - assertTrue(nativeSocket != 0); + Assert.assertTrue(nativeSocket != 0); } else { s = new ServerSocket(port, 100, InetAddress.getByName("localhost")); @@ -151,7 +147,7 @@ public class TestXxxEndpoint extends Tom if (e != null) { log.info("Exception was", e); } - assertNotNull(e); + Assert.assertNotNull(e); tomcat.getConnector().start(); } @@ -178,9 +174,9 @@ public class TestXxxEndpoint extends Tom // This should not throw an Exception if (isApr) { pool = createAprPool(); - assertTrue(pool != 0); + Assert.assertTrue(pool != 0); nativeSocket = createAprSocket(port, pool); - assertTrue(nativeSocket != 0); + Assert.assertTrue(nativeSocket != 0); } else { s = new ServerSocket(port, 100, InetAddress.getByName("localhost")); @@ -196,7 +192,7 @@ public class TestXxxEndpoint extends Tom } } catch (Exception e2) { /* Ignore */ } } - assertNull(e); + Assert.assertNull(e); tomcat.getConnector().start(); } } Modified: tomcat/trunk/test/org/apache/tomcat/util/net/openssl/TestOpenSSLConf.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/net/openssl/TestOpenSSLConf.java?rev=1815069&r1=1815068&r2=1815069&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/tomcat/util/net/openssl/TestOpenSSLConf.java (original) +++ tomcat/trunk/test/org/apache/tomcat/util/net/openssl/TestOpenSSLConf.java Mon Nov 13 10:09:23 2017 @@ -22,11 +22,7 @@ import java.util.Set; import org.hamcrest.CoreMatchers; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Assume; import org.junit.Test; @@ -54,7 +50,7 @@ public class TestOpenSSLConf extends Tom String sslImplementation = String.valueOf( tomcat.getConnector().getProperty("sslImplementationName")); Assume.assumeTrue("This test is only for OpenSSL based SSL connectors", - sslImplementation.contains("openssl")); + sslImplementation.contains("openssl")); } OpenSSLConfCmd cmd = new OpenSSLConfCmd(); @@ -64,13 +60,13 @@ public class TestOpenSSLConf extends Tom conf.addCmd(cmd); SSLHostConfig[] sslHostConfigs = tomcat.getConnector(). getProtocolHandler().findSslHostConfigs(); - assertEquals("Wrong SSLHostConfigCount", 1, sslHostConfigs.length); + Assert.assertEquals("Wrong SSLHostConfigCount", 1, sslHostConfigs.length); sslHostConfigs[0].setOpenSslConf(conf); tomcat.start(); sslHostConfigs = tomcat.getConnector().getProtocolHandler().findSslHostConfigs(); - assertEquals("Wrong SSLHostConfigCount", 1, sslHostConfigs.length); + Assert.assertEquals("Wrong SSLHostConfigCount", 1, sslHostConfigs.length); return sslHostConfigs[0]; } @@ -79,11 +75,11 @@ public class TestOpenSSLConf extends Tom SSLHostConfig sslHostConfig = initOpenSSLConfCmdCipher("CipherString", ENABLED_CIPHER); String[] ciphers = sslHostConfig.getEnabledCiphers(); - assertThat("Wrong HostConfig ciphers", ciphers, - CoreMatchers.is(EXPECTED_CIPHERS)); + Assert.assertThat("Wrong HostConfig ciphers", ciphers, + CoreMatchers.is(EXPECTED_CIPHERS)); ciphers = SSLContext.getCiphers(sslHostConfig.getOpenSslContext().longValue()); - assertThat("Wrong native SSL context ciphers", ciphers, - CoreMatchers.is(EXPECTED_CIPHERS)); + Assert.assertThat("Wrong native SSL context ciphers", ciphers, + CoreMatchers.is(EXPECTED_CIPHERS)); } @Test @@ -100,13 +96,13 @@ public class TestOpenSSLConf extends Tom sb.substring(1)); String[] protocols = sslHostConfig.getEnabledProtocols(); for (String protocol : protocols) { - assertFalse("Protocol " + protocol + " is not allowed", - disabledProtocols.contains(protocol)); + Assert.assertFalse("Protocol " + protocol + " is not allowed", + disabledProtocols.contains(protocol)); } Set<String> enabledProtocols = new HashSet<>(Arrays.asList(protocols)); for (String protocol : ENABLED_PROTOCOLS) { - assertTrue("Protocol " + protocol + " is not enabled", - enabledProtocols.contains(protocol)); + Assert.assertTrue("Protocol " + protocol + " is not enabled", + enabledProtocols.contains(protocol)); } } } Modified: tomcat/trunk/test/org/apache/tomcat/util/res/TestStringManager.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/res/TestStringManager.java?rev=1815069&r1=1815068&r2=1815069&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/tomcat/util/res/TestStringManager.java (original) +++ tomcat/trunk/test/org/apache/tomcat/util/res/TestStringManager.java Mon Nov 13 10:09:23 2017 @@ -14,11 +14,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.apache.tomcat.util.res; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Test; public class TestStringManager { @@ -35,7 +33,7 @@ public class TestStringManager { } catch (IllegalArgumentException iae) { iaeThrown = true; } - assertTrue("IAE not thrown on null key", iaeThrown); + Assert.assertTrue("IAE not thrown on null key", iaeThrown); } @Test Modified: tomcat/trunk/test/org/apache/tomcat/util/scan/TestJarScanner.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/tomcat/util/scan/TestJarScanner.java?rev=1815069&r1=1815068&r2=1815069&view=diff ============================================================================== --- tomcat/trunk/test/org/apache/tomcat/util/scan/TestJarScanner.java (original) +++ tomcat/trunk/test/org/apache/tomcat/util/scan/TestJarScanner.java Mon Nov 13 10:09:23 2017 @@ -14,16 +14,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.apache.tomcat.util.scan; import java.util.StringTokenizer; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - +import org.junit.Assert; import org.junit.Test; import org.apache.catalina.startup.TomcatBaseTest; @@ -34,18 +29,18 @@ public class TestJarScanner extends Tomc public void testJarsToSkipFormat() { String jarList = System.getProperty(Constants.SKIP_JARS_PROPERTY); - assertNotNull("Jar skip list is null", jarList); - assertFalse("Jar skip list is empty", jarList.isEmpty()); + Assert.assertNotNull("Jar skip list is null", jarList); + Assert.assertFalse("Jar skip list is empty", jarList.isEmpty()); StringTokenizer tokenizer = new StringTokenizer(jarList, ","); String token; while (tokenizer.hasMoreElements()) { token = tokenizer.nextToken(); - assertTrue("Token \"" + token + "\" does not end with \".jar\"", - token.endsWith(".jar")); - assertEquals("Token \"" + token + "\" contains sub string \".jar\"" + - " or separator \",\" is missing", - token.length() - ".jar".length(), - token.indexOf(".jar")); + Assert.assertTrue("Token \"" + token + "\" does not end with \".jar\"", + token.endsWith(".jar")); + Assert.assertEquals("Token \"" + token + "\" contains sub string \".jar\"" + + " or separator \",\" is missing", + token.length() - ".jar".length(), + token.indexOf(".jar")); } } } --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org