From 2bbfeb5bf7534acaaf0e78dfda5e04e63a72baed Mon Sep 17 00:00:00 2001 From: Sebastian Bazley Date: Mon, 24 Feb 2014 21:40:41 +0000 Subject: [PATCH] General tidy git-svn-id: https://svn.apache.org/repos/asf/httpcomponents/httpclient/trunk@1571453 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/http/conn/ssl/TestSSLContextBuilder.java | 4 ++-- .../http/impl/client/integration/TestCookieVirtualHost.java | 6 ++++++ .../org/apache/http/impl/conn/SessionInputBufferMock.java | 1 - .../http/impl/conn/TestSystemDefaultRoutePlanner.java | 3 ++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLContextBuilder.java b/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLContextBuilder.java index cfc9d0d74..cf906ba2b 100644 --- a/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLContextBuilder.java +++ b/httpclient/src/test/java/org/apache/http/conn/ssl/TestSSLContextBuilder.java @@ -82,7 +82,7 @@ public class TestSSLContextBuilder { final KeyStore keystore = load("test-keypasswd.keystore", "nopassword".toCharArray()); final String keyPassword = "password"; new SSLContextBuilder() - .loadKeyMaterial(keystore, keyPassword != null ? keyPassword.toCharArray() : null) + .loadKeyMaterial(keystore, keyPassword.toCharArray()) .loadTrustMaterial(keystore) .build(); } @@ -92,7 +92,7 @@ public class TestSSLContextBuilder { final KeyStore keystore = load("test-keypasswd.keystore", "nopassword".toCharArray()); final String keyPassword = "!password"; new SSLContextBuilder() - .loadKeyMaterial(keystore, keyPassword != null ? keyPassword.toCharArray() : null) + .loadKeyMaterial(keystore, keyPassword.toCharArray()) .loadTrustMaterial(keystore) .build(); } diff --git a/httpclient/src/test/java/org/apache/http/impl/client/integration/TestCookieVirtualHost.java b/httpclient/src/test/java/org/apache/http/impl/client/integration/TestCookieVirtualHost.java index e7daa2c6f..d0db1ea39 100644 --- a/httpclient/src/test/java/org/apache/http/impl/client/integration/TestCookieVirtualHost.java +++ b/httpclient/src/test/java/org/apache/http/impl/client/integration/TestCookieVirtualHost.java @@ -107,6 +107,9 @@ public class TestCookieVirtualHost extends IntegrationTestBase { response.setStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_OK); break; + default: + Assert.fail("Unexpected value: " + n); + break; } } @@ -122,6 +125,7 @@ public class TestCookieVirtualHost extends IntegrationTestBase { URI uri = new URI("http://app.mydomain.fr"); HttpRequest httpRequest = new HttpGet(uri); httpRequest.addHeader("X-Request", "1"); + @SuppressWarnings("resource") final HttpResponse response1 = this.httpclient.execute(getServerHttp(), httpRequest, context); final HttpEntity e1 = response1.getEntity(); @@ -137,6 +141,7 @@ public class TestCookieVirtualHost extends IntegrationTestBase { uri = new URI("http://app.mydomain.fr"); httpRequest = new HttpGet(uri); httpRequest.addHeader("X-Request", "2"); + @SuppressWarnings("resource") final HttpResponse response2 = this.httpclient.execute(getServerHttp(), httpRequest, context); final HttpEntity e2 = response2.getEntity(); @@ -146,6 +151,7 @@ public class TestCookieVirtualHost extends IntegrationTestBase { uri = new URI("http://app.mydomain.fr"); httpRequest = new HttpGet(uri); httpRequest.addHeader("X-Request", "3"); + @SuppressWarnings("resource") final HttpResponse response3 = this.httpclient.execute(getServerHttp(), httpRequest, context); final HttpEntity e3 = response3.getEntity(); diff --git a/httpclient/src/test/java/org/apache/http/impl/conn/SessionInputBufferMock.java b/httpclient/src/test/java/org/apache/http/impl/conn/SessionInputBufferMock.java index d96f6361f..15c9f20ce 100644 --- a/httpclient/src/test/java/org/apache/http/impl/conn/SessionInputBufferMock.java +++ b/httpclient/src/test/java/org/apache/http/impl/conn/SessionInputBufferMock.java @@ -30,7 +30,6 @@ package org.apache.http.impl.conn; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; -import java.io.UnsupportedEncodingException; import java.nio.charset.Charset; import java.nio.charset.CharsetDecoder; diff --git a/httpclient/src/test/java/org/apache/http/impl/conn/TestSystemDefaultRoutePlanner.java b/httpclient/src/test/java/org/apache/http/impl/conn/TestSystemDefaultRoutePlanner.java index 2ce57ab2f..38920ba2e 100644 --- a/httpclient/src/test/java/org/apache/http/impl/conn/TestSystemDefaultRoutePlanner.java +++ b/httpclient/src/test/java/org/apache/http/impl/conn/TestSystemDefaultRoutePlanner.java @@ -46,6 +46,7 @@ import org.apache.http.protocol.HttpContext; import org.junit.Assert; import org.junit.Before; import org.junit.Test; +import org.mockito.Matchers; import org.mockito.Mockito; /** @@ -76,7 +77,7 @@ public class TestSystemDefaultRoutePlanner { Assert.assertEquals(target, route.getTargetHost()); Assert.assertEquals(1, route.getHopCount()); Assert.assertFalse(route.isSecure()); - Mockito.verify(schemePortResolver, Mockito.never()).resolve(Mockito.any()); + Mockito.verify(schemePortResolver, Mockito.never()).resolve(Matchers.any()); } @Test