Replace assert calls by simpler but equivalent calls.
diff --git a/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestH2Settings.java b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestH2Settings.java
index 5090b1a..eca76d7 100644
--- a/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestH2Settings.java
+++ b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/frame/TestH2Settings.java
@@ -39,8 +39,8 @@
Assert.assertEquals(param, H2Param.valueOf(param.getCode()));
Assert.assertEquals(param.name(), H2Param.toString(param.getCode()));
}
- Assert.assertEquals(null, H2Param.valueOf(0));
- Assert.assertEquals(null, H2Param.valueOf(10));
+ Assert.assertNull(H2Param.valueOf(0));
+ Assert.assertNull(H2Param.valueOf(10));
Assert.assertEquals("0", H2Param.toString(0));
Assert.assertEquals("10", H2Param.toString(10));
}
diff --git a/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/nio/TestFrameInOutBuffers.java b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/nio/TestFrameInOutBuffers.java
index cf6ab17..847af07 100644
--- a/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/nio/TestFrameInOutBuffers.java
+++ b/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/impl/nio/TestFrameInOutBuffers.java
@@ -238,7 +238,7 @@
final FrameInputBuffer inBuffer = new FrameInputBuffer(16 * 1024);
final ReadableByteChannelMock readableChannel = new ReadableByteChannelMock(new byte[] {});
- Assert.assertEquals(null, inBuffer.read(readableChannel));
+ Assert.assertNull(inBuffer.read(readableChannel));
Assert.assertThrows(ConnectionClosedException.class, () ->
inBuffer.read(readableChannel));
}
diff --git a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestTestingFramework.java b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestTestingFramework.java
index 9a4c64a..cf63850 100644
--- a/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestTestingFramework.java
+++ b/httpcore5-testing/src/test/java/org/apache/hc/core5/testing/framework/TestTestingFramework.java
@@ -443,7 +443,7 @@
final TestingFrameworkRequestHandler requestHandler,
final Map<String, Object> responseExpectations) throws TestingFrameworkException {
// change the request from what is expected.
- Assert.assertTrue(request.get(METHOD).equals("GET"));
+ Assert.assertEquals("GET", request.get(METHOD));
request.put(METHOD, "POST");
return super.execute(defaultURI, request, requestHandler, responseExpectations);
}
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/TestContentType.java b/httpcore5/src/test/java/org/apache/hc/core5/http/TestContentType.java
index e56fbaa..fea9427 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/TestContentType.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/TestContentType.java
@@ -102,26 +102,26 @@
Assert.assertEquals(StandardCharsets.US_ASCII, contentType.getCharset());
Assert.assertEquals("text/plain; charset=ascii; p0; p1=blah-blah; p2=\" yada yada \"",
contentType.toString());
- Assert.assertEquals(null, contentType.getParameter("p0"));
+ Assert.assertNull(contentType.getParameter("p0"));
Assert.assertEquals("blah-blah", contentType.getParameter("p1"));
Assert.assertEquals(" yada yada ", contentType.getParameter("p2"));
- Assert.assertEquals(null, contentType.getParameter("p3"));
+ Assert.assertNull(contentType.getParameter("p3"));
}
@Test
public void testParseEmptyCharset() throws Exception {
final ContentType contentType = ContentType.parse("text/plain; charset=\" \"");
Assert.assertEquals("text/plain", contentType.getMimeType());
- Assert.assertEquals(null, contentType.getCharset());
+ Assert.assertNull(contentType.getCharset());
}
@Test
public void testParseEmptyValue() throws Exception {
- Assert.assertEquals(null, ContentType.parse(null));
- Assert.assertEquals(null, ContentType.parse(""));
- Assert.assertEquals(null, ContentType.parse(" "));
- Assert.assertEquals(null, ContentType.parse(";"));
- Assert.assertEquals(null, ContentType.parse("="));
+ Assert.assertNull(ContentType.parse(null));
+ Assert.assertNull(ContentType.parse(""));
+ Assert.assertNull(ContentType.parse(" "));
+ Assert.assertNull(ContentType.parse(";"));
+ Assert.assertNull(ContentType.parse("="));
}
@Test
@@ -144,7 +144,7 @@
contentType = ContentType.create("text/blah").withParameters(
new BasicNameValuePair("p", "blah"));
Assert.assertEquals("text/blah", contentType.getMimeType());
- Assert.assertEquals(null, contentType.getCharset());
+ Assert.assertNull(contentType.getCharset());
Assert.assertEquals("text/blah; p=blah", contentType.toString());
contentType = ContentType.create("text/blah", StandardCharsets.ISO_8859_1).withParameters(
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/TestHttpHost.java b/httpcore5/src/test/java/org/apache/hc/core5/http/TestHttpHost.java
index da2e5b3..e666bf9 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/TestHttpHost.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/TestHttpHost.java
@@ -89,15 +89,15 @@
final HttpHost host11 = new HttpHost(
"http", InetAddress.getByAddress("someotherhost",new byte[] {127,0,0,1}), 80);
- Assert.assertTrue(host1.hashCode() == host1.hashCode());
+ Assert.assertEquals(host1.hashCode(), host1.hashCode());
Assert.assertTrue(host1.hashCode() != host2.hashCode());
Assert.assertTrue(host1.hashCode() != host3.hashCode());
- Assert.assertTrue(host2.hashCode() == host4.hashCode());
- Assert.assertTrue(host2.hashCode() == host5.hashCode());
+ Assert.assertEquals(host2.hashCode(), host4.hashCode());
+ Assert.assertEquals(host2.hashCode(), host5.hashCode());
Assert.assertTrue(host5.hashCode() != host6.hashCode());
Assert.assertTrue(host7.hashCode() != host8.hashCode());
Assert.assertTrue(host8.hashCode() != host9.hashCode());
- Assert.assertTrue(host9.hashCode() == host10.hashCode());
+ Assert.assertEquals(host9.hashCode(), host10.hashCode());
Assert.assertTrue(host10.hashCode() != host11.hashCode());
Assert.assertTrue(host9.hashCode() != host11.hashCode());
}
@@ -120,20 +120,20 @@
final HttpHost host11 = new HttpHost(
"http", InetAddress.getByAddress("someotherhost",new byte[] {127,0,0,1}), 80);
- Assert.assertTrue(host1.equals(host1));
- Assert.assertFalse(host1.equals(host2));
- Assert.assertFalse(host1.equals(host3));
- Assert.assertTrue(host2.equals(host4));
- Assert.assertTrue(host2.equals(host5));
- Assert.assertFalse(host5.equals(host6));
- Assert.assertFalse(host7.equals(host8));
- Assert.assertTrue(!host7.equals(host9));
- Assert.assertFalse(host1.equals(null));
- Assert.assertFalse(host1.equals("http://somehost"));
- Assert.assertFalse(host9.equals("http://somehost"));
- Assert.assertFalse(host8.equals(host9));
- Assert.assertTrue(host9.equals(host10));
- Assert.assertFalse(host9.equals(host11));
+ Assert.assertEquals(host1, host1);
+ Assert.assertNotEquals(host1, host2);
+ Assert.assertNotEquals(host1, host3);
+ Assert.assertEquals(host2, host4);
+ Assert.assertEquals(host2, host5);
+ Assert.assertNotEquals(host5, host6);
+ Assert.assertNotEquals(host7, host8);
+ Assert.assertFalse(host7.equals(host9));
+ Assert.assertNotEquals(null, host1);
+ Assert.assertNotEquals("http://somehost", host1);
+ Assert.assertNotEquals("http://somehost", host9);
+ Assert.assertNotEquals(host8, host9);
+ Assert.assertEquals(host9, host10);
+ Assert.assertNotEquals(host9, host11);
}
@Test
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/TestHttpVersion.java b/httpcore5/src/test/java/org/apache/hc/core5/http/TestHttpVersion.java
index 7885d8c..c2e042c 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/TestHttpVersion.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/TestHttpVersion.java
@@ -81,35 +81,27 @@
final HttpVersion ver2 = new HttpVersion(1, 1);
Assert.assertEquals(ver1.hashCode(), ver2.hashCode());
- Assert.assertTrue(ver1.equals(ver1));
- Assert.assertTrue(ver1.equals(ver2));
- Assert.assertTrue(ver1.equals(ver1));
- Assert.assertTrue(ver1.equals(ver2));
+ Assert.assertEquals(ver1, ver1);
+ Assert.assertEquals(ver1, ver2);
+ Assert.assertEquals(ver1, ver1);
+ Assert.assertEquals(ver1, ver2);
Assert.assertFalse(ver1.equals(Float.valueOf(1.1f)));
- Assert.assertTrue((new HttpVersion(0, 9)).equals(HttpVersion.HTTP_0_9));
- Assert.assertTrue((new HttpVersion(1, 0)).equals(HttpVersion.HTTP_1_0));
- Assert.assertTrue((new HttpVersion(1, 1)).equals(HttpVersion.HTTP_1_1));
- Assert.assertFalse((new HttpVersion(1, 1)).equals(HttpVersion.HTTP_1_0));
+ Assert.assertEquals((new HttpVersion(0, 9)), HttpVersion.HTTP_0_9);
+ Assert.assertEquals((new HttpVersion(1, 0)), HttpVersion.HTTP_1_0);
+ Assert.assertEquals((new HttpVersion(1, 1)), HttpVersion.HTTP_1_1);
+ Assert.assertNotEquals((new HttpVersion(1, 1)), HttpVersion.HTTP_1_0);
- Assert.assertTrue
- ((new ProtocolVersion("HTTP", 0, 9)).equals(HttpVersion.HTTP_0_9));
- Assert.assertTrue
- ((new ProtocolVersion("HTTP", 1, 0)).equals(HttpVersion.HTTP_1_0));
- Assert.assertTrue
- ((new ProtocolVersion("HTTP", 1, 1)).equals(HttpVersion.HTTP_1_1));
- Assert.assertFalse
- ((new ProtocolVersion("http", 1, 1)).equals(HttpVersion.HTTP_1_1));
+ Assert.assertEquals((new ProtocolVersion("HTTP", 0, 9)), HttpVersion.HTTP_0_9);
+ Assert.assertEquals((new ProtocolVersion("HTTP", 1, 0)), HttpVersion.HTTP_1_0);
+ Assert.assertEquals((new ProtocolVersion("HTTP", 1, 1)), HttpVersion.HTTP_1_1);
+ Assert.assertNotEquals((new ProtocolVersion("http", 1, 1)), HttpVersion.HTTP_1_1);
- Assert.assertTrue
- (HttpVersion.HTTP_0_9.equals(new ProtocolVersion("HTTP", 0, 9)));
- Assert.assertTrue
- (HttpVersion.HTTP_1_0.equals(new ProtocolVersion("HTTP", 1, 0)));
- Assert.assertTrue
- (HttpVersion.HTTP_1_1.equals(new ProtocolVersion("HTTP", 1, 1)));
- Assert.assertFalse
- (HttpVersion.HTTP_1_1.equals(new ProtocolVersion("http", 1, 1)));
+ Assert.assertEquals(HttpVersion.HTTP_0_9, new ProtocolVersion("HTTP", 0, 9));
+ Assert.assertEquals(HttpVersion.HTTP_1_0, new ProtocolVersion("HTTP", 1, 0));
+ Assert.assertEquals(HttpVersion.HTTP_1_1, new ProtocolVersion("HTTP", 1, 1));
+ Assert.assertNotEquals(HttpVersion.HTTP_1_1, new ProtocolVersion("http", 1, 1));
}
@Test
@@ -120,7 +112,7 @@
Assert.assertTrue(HttpVersion.HTTP_1_0.compareToVersion(HttpVersion.HTTP_1_1) < 0);
Assert.assertTrue(HttpVersion.HTTP_1_0.compareToVersion(HttpVersion.HTTP_0_9) > 0);
- Assert.assertTrue(HttpVersion.HTTP_1_0.compareToVersion(HttpVersion.HTTP_1_0) == 0);
+ Assert.assertEquals(0, HttpVersion.HTTP_1_0.compareToVersion(HttpVersion.HTTP_1_0));
}
@Test
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/config/TestRegistry.java b/httpcore5/src/test/java/org/apache/hc/core5/http/config/TestRegistry.java
index eb7f921..ed3d3e3 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/config/TestRegistry.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/config/TestRegistry.java
@@ -36,8 +36,8 @@
final Registry<String> reg = RegistryBuilder.<String>create().register("Stuff", "Stuff").build();
Assert.assertEquals("Stuff", reg.lookup("Stuff"));
Assert.assertEquals("Stuff", reg.lookup("stuff"));
- Assert.assertEquals(null, reg.lookup("miss"));
- Assert.assertEquals(null, reg.lookup(null));
+ Assert.assertNull(reg.lookup("miss"));
+ Assert.assertNull(reg.lookup(null));
}
}
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestBHttpConnectionBase.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestBHttpConnectionBase.java
index 73e2494..32032e6 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestBHttpConnectionBase.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestBHttpConnectionBase.java
@@ -67,8 +67,8 @@
@Test
public void testBasics() throws Exception {
Assert.assertFalse(conn.isOpen());
- Assert.assertEquals(null, conn.getLocalAddress());
- Assert.assertEquals(null, conn.getRemoteAddress());
+ Assert.assertNull(conn.getLocalAddress());
+ Assert.assertNull(conn.getRemoteAddress());
Assert.assertEquals("[Not bound]", conn.toString());
}
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestContentLengthInputStream.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestContentLengthInputStream.java
index fe97250..a0be3d2 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestContentLengthInputStream.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestContentLengthInputStream.java
@@ -66,7 +66,7 @@
final SessionInputBuffer inBuffer1 = new SessionInputBufferImpl(16);
final InputStream in1 = new ContentLengthInputStream(inBuffer1, inputStream1, 10L);
Assert.assertEquals(10, in1.skip(10));
- Assert.assertTrue(in1.read() == -1);
+ Assert.assertEquals(-1, in1.read());
in1.close();
final ByteArrayInputStream inputStream2 = new ByteArrayInputStream(new byte[20]);
@@ -74,7 +74,7 @@
final InputStream in2 = new ContentLengthInputStream(inBuffer2, inputStream2, 10L);
in2.read();
Assert.assertEquals(9, in2.skip(10));
- Assert.assertTrue(in2.read() == -1);
+ Assert.assertEquals(-1, in2.read());
in2.close();
final ByteArrayInputStream inputStream3 = new ByteArrayInputStream(new byte[20]);
@@ -83,8 +83,8 @@
in3.read();
in3.read();
Assert.assertTrue(in3.skip(10) <= 0);
- Assert.assertTrue(in3.skip(-1) == 0);
- Assert.assertTrue(in3.read() == -1);
+ Assert.assertEquals(0, in3.skip(-1));
+ Assert.assertEquals(-1, in3.read());
in3.close();
final ByteArrayInputStream inputStream4 = new ByteArrayInputStream(new byte[20]);
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java
index d74cc79..15a61a6 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpClientConnection.java
@@ -176,7 +176,7 @@
final HttpEntity entity = response.getEntity();
Assert.assertNotNull(entity);
Assert.assertEquals(-1, entity.getContentLength());
- Assert.assertEquals(true, entity.isChunked());
+ Assert.assertTrue(entity.isChunked());
Assert.assertEquals(1, conn.getEndpointDetails().getResponseCount());
final InputStream content = entity.getContent();
Assert.assertNotNull(content);
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java
index 016d10d..8b4c1db 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/io/TestDefaultBHttpServerConnection.java
@@ -148,7 +148,7 @@
final HttpEntity entity = request.getEntity();
Assert.assertNotNull(entity);
Assert.assertEquals(-1, entity.getContentLength());
- Assert.assertEquals(true, entity.isChunked());
+ Assert.assertTrue(entity.isChunked());
Assert.assertEquals(1, conn.getEndpointDetails().getRequestCount());
final InputStream content = entity.getContent();
Assert.assertNotNull(content);
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkDecoder.java b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkDecoder.java
index 28d2e9b..db83009 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkDecoder.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/impl/nio/TestChunkDecoder.java
@@ -65,7 +65,7 @@
Assert.assertEquals(16, bytesRead);
Assert.assertEquals("0123456789abcdef", CodecTestUtils.convert(dst));
final List<? extends Header> trailers = decoder.getTrailers();
- Assert.assertEquals(null, trailers);
+ Assert.assertNull(trailers);
dst.clear();
bytesRead = decoder.read(dst);
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicHeaderValueParser.java b/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicHeaderValueParser.java
index a66bd53..1e1b475 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicHeaderValueParser.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicHeaderValueParser.java
@@ -63,7 +63,7 @@
// 1st element has 2 getParameters()
Assert.assertEquals(2,elements[0].getParameters().length);
Assert.assertEquals("name2",elements[0].getParameters()[0].getName());
- Assert.assertEquals(null, elements[0].getParameters()[0].getValue());
+ Assert.assertNull(elements[0].getParameters()[0].getValue());
Assert.assertEquals("name3",elements[0].getParameters()[1].getName());
Assert.assertEquals("value3",elements[0].getParameters()[1].getValue());
// 2nd element
@@ -141,7 +141,7 @@
NameValuePair param = this.parser.parseNameValuePair(buffer, cursor);
Assert.assertEquals("test", param.getName());
- Assert.assertEquals(null, param.getValue());
+ Assert.assertNull(param.getValue());
Assert.assertEquals(s.length(), cursor.getPos());
Assert.assertTrue(cursor.atEnd());
@@ -152,7 +152,7 @@
param = this.parser.parseNameValuePair(buffer, cursor);
Assert.assertEquals("test", param.getName());
- Assert.assertEquals(null, param.getValue());
+ Assert.assertNull(param.getValue());
Assert.assertEquals(s.length(), cursor.getPos());
Assert.assertTrue(cursor.atEnd());
@@ -163,7 +163,7 @@
param = this.parser.parseNameValuePair(buffer, cursor);
Assert.assertEquals("test", param.getName());
- Assert.assertEquals(null, param.getValue());
+ Assert.assertNull(param.getValue());
Assert.assertEquals(s.length() - 2, cursor.getPos());
Assert.assertFalse(cursor.atEnd());
@@ -225,7 +225,7 @@
param = this.parser.parseNameValuePair(buffer, cursor);
Assert.assertEquals("test", param.getName());
- Assert.assertEquals(null, param.getValue());
+ Assert.assertNull(param.getValue());
s = " ";
buffer = new CharArrayBuffer(16);
@@ -234,7 +234,7 @@
param = this.parser.parseNameValuePair(buffer, cursor);
Assert.assertEquals("", param.getName());
- Assert.assertEquals(null, param.getValue());
+ Assert.assertNull(param.getValue());
s = " = stuff ";
buffer = new CharArrayBuffer(16);
@@ -256,7 +256,7 @@
NameValuePair[] params = this.parser.parseParameters(buffer, cursor);
Assert.assertEquals("test", params[0].getName());
- Assert.assertEquals(null, params[0].getValue());
+ Assert.assertNull(params[0].getValue());
Assert.assertEquals("test1", params[1].getName());
Assert.assertEquals("stuff", params[1].getValue());
Assert.assertEquals("test2", params[2].getName());
@@ -274,7 +274,7 @@
params = this.parser.parseParameters(buffer, cursor);
Assert.assertEquals("test", params[0].getName());
- Assert.assertEquals(null, params[0].getValue());
+ Assert.assertNull(params[0].getValue());
Assert.assertEquals("test1", params[1].getName());
Assert.assertEquals("stuff", params[1].getValue());
Assert.assertEquals("test2", params[2].getName());
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicMessages.java b/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicMessages.java
index 67d4b93..4187b4b 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicMessages.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestBasicMessages.java
@@ -102,7 +102,7 @@
Assert.assertEquals("Kind of OK", response.getReasonPhrase());
response.setCode(299);
Assert.assertEquals(299, response.getCode());
- Assert.assertEquals(null, response.getReasonPhrase());
+ Assert.assertNull(response.getReasonPhrase());
}
@Test
@@ -117,7 +117,7 @@
final HttpRequest request = new BasicHttpRequest(Method.GET, "/stuff");
Assert.assertEquals(Method.GET.name(), request.getMethod());
Assert.assertEquals("/stuff", request.getPath());
- Assert.assertEquals(null, request.getAuthority());
+ Assert.assertNull(request.getAuthority());
Assert.assertEquals(new URI("/stuff"), request.getUri());
}
@@ -126,7 +126,7 @@
final HttpRequest request = new BasicHttpRequest(Method.GET, new URI("/stuff"));
Assert.assertEquals(Method.GET.name(), request.getMethod());
Assert.assertEquals("/stuff", request.getPath());
- Assert.assertEquals(null, request.getAuthority());
+ Assert.assertNull(request.getAuthority());
Assert.assertEquals(new URI("/stuff"), request.getUri());
}
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestHeader.java b/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestHeader.java
index 68feeeb..ee3fb6b 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestHeader.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestHeader.java
@@ -52,7 +52,7 @@
public void testBasicConstructorNullValue() {
final Header header = new BasicHeader("name", null);
Assert.assertEquals("name", header.getName());
- Assert.assertEquals(null, header.getValue());
+ Assert.assertNull(header.getValue());
}
@Test
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestNameValuePair.java b/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestNameValuePair.java
index cfc96f2..71c556b 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestNameValuePair.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/message/TestNameValuePair.java
@@ -61,14 +61,14 @@
public void testNullNotEqual() throws Exception {
final NameValuePair NameValuePair = new BasicNameValuePair("name", "value");
- Assert.assertFalse(NameValuePair.equals(null));
+ Assert.assertNotEquals(null, NameValuePair);
}
@Test
public void testObjectNotEqual() throws Exception {
final NameValuePair NameValuePair = new BasicNameValuePair("name", "value");
- Assert.assertFalse(NameValuePair.equals(new Object()));
+ Assert.assertNotEquals(NameValuePair, new Object());
}
@Test
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestAbstractBinAsyncEntityConsumer.java b/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestAbstractBinAsyncEntityConsumer.java
index ea7609e..e9f1ef6 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestAbstractBinAsyncEntityConsumer.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestAbstractBinAsyncEntityConsumer.java
@@ -105,7 +105,7 @@
consumer.consume(ByteBuffer.wrap(new byte[]{'4', '5'}));
consumer.consume(ByteBuffer.wrap(new byte[]{}));
- Assert.assertEquals(null, consumer.getContent());
+ Assert.assertNull(consumer.getContent());
consumer.streamEnd(null);
Assert.assertArrayEquals(new byte[] {'1', '2', '3', '4', '5'}, consumer.getContent());
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestAbstractBinAsyncEntityProducer.java b/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestAbstractBinAsyncEntityProducer.java
index 584e016..8e3d199 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestAbstractBinAsyncEntityProducer.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestAbstractBinAsyncEntityProducer.java
@@ -92,7 +92,7 @@
Assert.assertEquals(-1, producer.getContentLength());
Assert.assertEquals(ContentType.TEXT_PLAIN.toString(), producer.getContentType());
- Assert.assertEquals(null, producer.getContentEncoding());
+ Assert.assertNull(producer.getContentEncoding());
final WritableByteChannelMock byteChannel = new WritableByteChannelMock(1024);
final DataStreamChannel streamChannel = new BasicDataStreamChannel(byteChannel);
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestAbstractCharAsyncEntityConsumer.java b/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestAbstractCharAsyncEntityConsumer.java
index 0fe3c85..c22ada9 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestAbstractCharAsyncEntityConsumer.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestAbstractCharAsyncEntityConsumer.java
@@ -106,7 +106,7 @@
consumer.consume(ByteBuffer.wrap(new byte[]{'4', '5'}));
consumer.consume(ByteBuffer.wrap(new byte[]{}));
- Assert.assertEquals(null, consumer.getContent());
+ Assert.assertNull(consumer.getContent());
consumer.streamEnd(null);
Assert.assertEquals("12345", consumer.getContent());
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestAbstractCharAsyncEntityProducer.java b/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestAbstractCharAsyncEntityProducer.java
index cf344b5..49b5699 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestAbstractCharAsyncEntityProducer.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestAbstractCharAsyncEntityProducer.java
@@ -91,7 +91,7 @@
Assert.assertEquals(-1, producer.getContentLength());
Assert.assertEquals(ContentType.TEXT_PLAIN.toString(), producer.getContentType());
- Assert.assertEquals(null, producer.getContentEncoding());
+ Assert.assertNull(producer.getContentEncoding());
final WritableByteChannelMock byteChannel = new WritableByteChannelMock(1024);
final DataStreamChannel streamChannel = new BasicDataStreamChannel(byteChannel);
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestBasicAsyncEntityProducer.java b/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestBasicAsyncEntityProducer.java
index 2a1d2f8..da2e999 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestBasicAsyncEntityProducer.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestBasicAsyncEntityProducer.java
@@ -47,7 +47,7 @@
Assert.assertEquals(3, producer.getContentLength());
Assert.assertEquals(ContentType.DEFAULT_BINARY.toString(), producer.getContentType());
- Assert.assertEquals(null, producer.getContentEncoding());
+ Assert.assertNull(producer.getContentEncoding());
final WritableByteChannelMock byteChannel = new WritableByteChannelMock(1024);
final DataStreamChannel streamChannel = new BasicDataStreamChannel(byteChannel);
@@ -66,7 +66,7 @@
Assert.assertEquals(3, producer.getContentLength());
Assert.assertEquals(ContentType.TEXT_PLAIN.toString(), producer.getContentType());
- Assert.assertEquals(null, producer.getContentEncoding());
+ Assert.assertNull(producer.getContentEncoding());
final WritableByteChannelMock byteChannel = new WritableByteChannelMock(1024);
final DataStreamChannel streamChannel = new BasicDataStreamChannel(byteChannel);
@@ -84,7 +84,7 @@
Assert.assertEquals(3, producer.getContentLength());
Assert.assertEquals(ContentType.TEXT_PLAIN.toString(), producer.getContentType());
- Assert.assertEquals(null, producer.getContentEncoding());
+ Assert.assertNull(producer.getContentEncoding());
for (int i = 0; i < 3; i++) {
final WritableByteChannelMock byteChannel = new WritableByteChannelMock(1024);
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestFileAsyncEntityProducer.java b/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestFileAsyncEntityProducer.java
index 25fbe8b..dcf3576 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestFileAsyncEntityProducer.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestFileAsyncEntityProducer.java
@@ -70,7 +70,7 @@
Assert.assertEquals(6, producer.getContentLength());
Assert.assertEquals(ContentType.TEXT_PLAIN.toString(), producer.getContentType());
- Assert.assertEquals(null, producer.getContentEncoding());
+ Assert.assertNull(producer.getContentEncoding());
final WritableByteChannelMock byteChannel = new WritableByteChannelMock(1024);
final DataStreamChannel streamChannel = new BasicDataStreamChannel(byteChannel);
@@ -88,7 +88,7 @@
Assert.assertEquals(6, producer.getContentLength());
Assert.assertEquals(ContentType.TEXT_PLAIN.toString(), producer.getContentType());
- Assert.assertEquals(null, producer.getContentEncoding());
+ Assert.assertNull(producer.getContentEncoding());
for (int i = 0; i < 3; i++) {
final WritableByteChannelMock byteChannel = new WritableByteChannelMock(1024);
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestStringAsyncEntityProducer.java b/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestStringAsyncEntityProducer.java
index 615dce9..a3e226c 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestStringAsyncEntityProducer.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/nio/entity/TestStringAsyncEntityProducer.java
@@ -47,7 +47,7 @@
Assert.assertEquals(-1, producer.getContentLength());
Assert.assertEquals(ContentType.TEXT_PLAIN.toString(), producer.getContentType());
- Assert.assertEquals(null, producer.getContentEncoding());
+ Assert.assertNull(producer.getContentEncoding());
final WritableByteChannelMock byteChannel = new WritableByteChannelMock(1024);
final DataStreamChannel streamChannel = new BasicDataStreamChannel(byteChannel);
@@ -65,7 +65,7 @@
Assert.assertEquals(-1, producer.getContentLength());
Assert.assertEquals(ContentType.TEXT_PLAIN.toString(), producer.getContentType());
- Assert.assertEquals(null, producer.getContentEncoding());
+ Assert.assertNull(producer.getContentEncoding());
for (int i = 0; i < 3; i++) {
final WritableByteChannelMock byteChannel = new WritableByteChannelMock(1024);
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestHttpExecutionContext.java b/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestHttpExecutionContext.java
index 5af3d6d..a99bbf8 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestHttpExecutionContext.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestHttpExecutionContext.java
@@ -46,12 +46,12 @@
Assert.assertEquals("1", parentContext.getAttribute("param1"));
Assert.assertEquals("2", parentContext.getAttribute("param2"));
- Assert.assertEquals(null, parentContext.getAttribute("param3"));
+ Assert.assertNull(parentContext.getAttribute("param3"));
Assert.assertEquals("1", currentContext.getAttribute("param1"));
Assert.assertEquals("4", currentContext.getAttribute("param2"));
Assert.assertEquals("3", currentContext.getAttribute("param3"));
- Assert.assertEquals(null, currentContext.getAttribute("param4"));
+ Assert.assertNull(currentContext.getAttribute("param4"));
currentContext.removeAttribute("param1");
currentContext.removeAttribute("param2");
@@ -60,16 +60,16 @@
Assert.assertEquals("1", currentContext.getAttribute("param1"));
Assert.assertEquals("2", currentContext.getAttribute("param2"));
- Assert.assertEquals(null, currentContext.getAttribute("param3"));
- Assert.assertEquals(null, currentContext.getAttribute("param4"));
+ Assert.assertNull(currentContext.getAttribute("param3"));
+ Assert.assertNull(currentContext.getAttribute("param4"));
}
@Test
public void testEmptyContextOperations() {
final HttpContext currentContext = new BasicHttpContext(null);
- Assert.assertEquals(null, currentContext.getAttribute("param1"));
+ Assert.assertNull(currentContext.getAttribute("param1"));
currentContext.removeAttribute("param1");
- Assert.assertEquals(null, currentContext.getAttribute("param1"));
+ Assert.assertNull(currentContext.getAttribute("param1"));
}
@Test
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestStandardInterceptors.java b/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestStandardInterceptors.java
index 30304a9..4565454 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestStandardInterceptors.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestStandardInterceptors.java
@@ -83,7 +83,7 @@
final Header header = request.getFirstHeader(HttpHeaders.CONNECTION);
Assert.assertNotNull(header);
Assert.assertEquals("close", header.getValue());
- Assert.assertTrue(header == myheader);
+ Assert.assertSame(header, myheader);
}
@Test
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestUriPatternMatcher.java b/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestUriPatternMatcher.java
index cba39c8..8888575 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestUriPatternMatcher.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestUriPatternMatcher.java
@@ -63,13 +63,13 @@
h = matcher.lookup("/h1");
Assert.assertNotNull(h);
- Assert.assertTrue(h1 == h);
+ Assert.assertSame(h1, h);
h = matcher.lookup("/h2");
Assert.assertNotNull(h);
- Assert.assertTrue(h2 == h);
+ Assert.assertSame(h2, h);
h = matcher.lookup("/h3");
Assert.assertNotNull(h);
- Assert.assertTrue(h3 == h);
+ Assert.assertSame(h3, h);
matcher.unregister("/h1");
h = matcher.lookup("/h1");
@@ -100,19 +100,19 @@
h = matcher.lookup("/one/request");
Assert.assertNotNull(h);
- Assert.assertTrue(h1 == h);
+ Assert.assertSame(h1, h);
h = matcher.lookup("/one/two/request");
Assert.assertNotNull(h);
- Assert.assertTrue(h2 == h);
+ Assert.assertSame(h2, h);
h = matcher.lookup("/one/two/three/request");
Assert.assertNotNull(h);
- Assert.assertTrue(h3 == h);
+ Assert.assertSame(h3, h);
h = matcher.lookup("default/request");
Assert.assertNotNull(h);
- Assert.assertTrue(def == h);
+ Assert.assertSame(def, h);
}
@Test
@@ -130,15 +130,15 @@
h = matcher.lookup("/that.view");
Assert.assertNotNull(h);
- Assert.assertTrue(h1 == h);
+ Assert.assertSame(h1, h);
h = matcher.lookup("/that.form");
Assert.assertNotNull(h);
- Assert.assertTrue(h2 == h);
+ Assert.assertSame(h2, h);
h = matcher.lookup("/whatever");
Assert.assertNotNull(h);
- Assert.assertTrue(def == h);
+ Assert.assertSame(def, h);
}
@Test
@@ -152,7 +152,7 @@
final Object h = matcher.lookup("/match");
Assert.assertNotNull(h);
- Assert.assertTrue(h1 == h);
+ Assert.assertSame(h1, h);
}
@Test
@@ -180,7 +180,7 @@
final Object h = matcher.lookup("exact");
Assert.assertNotNull(h);
- Assert.assertTrue(h1 == h);
+ Assert.assertSame(h1, h);
}
}
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestUriPatternOrderedMatcher.java b/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestUriPatternOrderedMatcher.java
index 1a79351..19c5bc3 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestUriPatternOrderedMatcher.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestUriPatternOrderedMatcher.java
@@ -63,13 +63,13 @@
h = matcher.lookup("/h1");
Assert.assertNotNull(h);
- Assert.assertTrue(h1 == h);
+ Assert.assertSame(h1, h);
h = matcher.lookup("/h2");
Assert.assertNotNull(h);
- Assert.assertTrue(h2 == h);
+ Assert.assertSame(h2, h);
h = matcher.lookup("/h3");
Assert.assertNotNull(h);
- Assert.assertTrue(h3 == h);
+ Assert.assertSame(h3, h);
matcher.unregister("/h1");
h = matcher.lookup("/h1");
@@ -100,19 +100,19 @@
h = matcher.lookup("/one/request");
Assert.assertNotNull(h);
- Assert.assertTrue(def == h);
+ Assert.assertSame(def, h);
h = matcher.lookup("/one/two/request");
Assert.assertNotNull(h);
- Assert.assertTrue(def == h);
+ Assert.assertSame(def, h);
h = matcher.lookup("/one/two/three/request");
Assert.assertNotNull(h);
- Assert.assertTrue(def == h);
+ Assert.assertSame(def, h);
h = matcher.lookup("default/request");
Assert.assertNotNull(h);
- Assert.assertTrue(def == h);
+ Assert.assertSame(def, h);
}
@Test
@@ -130,15 +130,15 @@
h = matcher.lookup("/that.view");
Assert.assertNotNull(h);
- Assert.assertTrue(def == h);
+ Assert.assertSame(def, h);
h = matcher.lookup("/that.form");
Assert.assertNotNull(h);
- Assert.assertTrue(def == h);
+ Assert.assertSame(def, h);
h = matcher.lookup("/whatever");
Assert.assertNotNull(h);
- Assert.assertTrue(def == h);
+ Assert.assertSame(def, h);
}
@Test
@@ -152,7 +152,7 @@
final Object h = matcher.lookup("/match");
Assert.assertNotNull(h);
- Assert.assertTrue(h1 == h);
+ Assert.assertSame(h1, h);
}
@Test
@@ -180,7 +180,7 @@
final Object h = matcher.lookup("exact");
Assert.assertNotNull(h);
- Assert.assertTrue(h1 == h);
+ Assert.assertSame(h1, h);
}
@Test
@@ -194,7 +194,7 @@
final Object h = matcher.lookup("exact");
Assert.assertNotNull(h);
- Assert.assertTrue(h1 == h);
+ Assert.assertSame(h1, h);
}
@Test
@@ -208,6 +208,6 @@
final Object h = matcher.lookup("exact");
Assert.assertNotNull(h);
- Assert.assertTrue(h1 == h);
+ Assert.assertSame(h1, h);
}
}
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestUriRegexMatcher.java b/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestUriRegexMatcher.java
index 4c71a66..a34c5ac 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestUriRegexMatcher.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/http/protocol/TestUriRegexMatcher.java
@@ -47,13 +47,13 @@
h = matcher.lookup("/h1");
Assert.assertNotNull(h);
- Assert.assertTrue(h1 == h);
+ Assert.assertSame(h1, h);
h = matcher.lookup("/h2");
Assert.assertNotNull(h);
- Assert.assertTrue(h2 == h);
+ Assert.assertSame(h2, h);
h = matcher.lookup("/h3");
Assert.assertNotNull(h);
- Assert.assertTrue(h3 == h);
+ Assert.assertSame(h3, h);
matcher.unregister("/h1");
h = matcher.lookup("/h1");
@@ -84,19 +84,19 @@
h = matcher.lookup("/one/request");
Assert.assertNotNull(h);
- Assert.assertTrue(def == h);
+ Assert.assertSame(def, h);
h = matcher.lookup("/one/two/request");
Assert.assertNotNull(h);
- Assert.assertTrue(def == h);
+ Assert.assertSame(def, h);
h = matcher.lookup("/one/two/three/request");
Assert.assertNotNull(h);
- Assert.assertTrue(def == h);
+ Assert.assertSame(def, h);
h = matcher.lookup("default/request");
Assert.assertNotNull(h);
- Assert.assertTrue(def == h);
+ Assert.assertSame(def, h);
}
@Test
@@ -116,19 +116,19 @@
h = matcher.lookup("/one/request");
Assert.assertNotNull(h);
- Assert.assertTrue(h1 == h);
+ Assert.assertSame(h1, h);
h = matcher.lookup("/one/two/request");
Assert.assertNotNull(h);
- Assert.assertTrue(h2 == h);
+ Assert.assertSame(h2, h);
h = matcher.lookup("/one/two/three/request");
Assert.assertNotNull(h);
- Assert.assertTrue(h3 == h);
+ Assert.assertSame(h3, h);
h = matcher.lookup("default/request");
Assert.assertNotNull(h);
- Assert.assertTrue(def == h);
+ Assert.assertSame(def, h);
}
@Test
@@ -146,15 +146,15 @@
h = matcher.lookup("/that.view");
Assert.assertNotNull(h);
- Assert.assertTrue(def == h);
+ Assert.assertSame(def, h);
h = matcher.lookup("/that.form");
Assert.assertNotNull(h);
- Assert.assertTrue(def == h);
+ Assert.assertSame(def, h);
h = matcher.lookup("/whatever");
Assert.assertNotNull(h);
- Assert.assertTrue(def == h);
+ Assert.assertSame(def, h);
}
@Test
@@ -172,15 +172,15 @@
h = matcher.lookup("/that.view");
Assert.assertNotNull(h);
- Assert.assertTrue(h1 == h);
+ Assert.assertSame(h1, h);
h = matcher.lookup("/that.form");
Assert.assertNotNull(h);
- Assert.assertTrue(h2 == h);
+ Assert.assertSame(h2, h);
h = matcher.lookup("/whatever");
Assert.assertNotNull(h);
- Assert.assertTrue(def == h);
+ Assert.assertSame(def, h);
}
@Test
@@ -194,7 +194,7 @@
final Object h = matcher.lookup("/match");
Assert.assertNotNull(h);
- Assert.assertTrue(h1 == h);
+ Assert.assertSame(h1, h);
}
@Test
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/net/TestHost.java b/httpcore5/src/test/java/org/apache/hc/core5/net/TestHost.java
index 13f068d..cab9ae0 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/net/TestHost.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/net/TestHost.java
@@ -60,10 +60,10 @@
final Host host3 = new Host("someotherhost", 8080);
final Host host4 = new Host("somehost", 80);
- Assert.assertTrue(host1.hashCode() == host1.hashCode());
+ Assert.assertEquals(host1.hashCode(), host1.hashCode());
Assert.assertTrue(host1.hashCode() != host2.hashCode());
Assert.assertTrue(host1.hashCode() != host3.hashCode());
- Assert.assertTrue(host2.hashCode() == host4.hashCode());
+ Assert.assertEquals(host2.hashCode(), host4.hashCode());
}
@Test
@@ -73,10 +73,10 @@
final Host host3 = new Host("someotherhost", 8080);
final Host host4 = new Host("somehost", 80);
- Assert.assertTrue(host1.equals(host1));
- Assert.assertFalse(host1.equals(host2));
- Assert.assertFalse(host1.equals(host3));
- Assert.assertTrue(host2.equals(host4));
+ Assert.assertEquals(host1, host1);
+ Assert.assertNotEquals(host1, host2);
+ Assert.assertNotEquals(host1, host3);
+ Assert.assertEquals(host2, host4);
}
@Test
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/net/TestURIAuthority.java b/httpcore5/src/test/java/org/apache/hc/core5/net/TestURIAuthority.java
index f74604c..5389797 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/net/TestURIAuthority.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/net/TestURIAuthority.java
@@ -67,13 +67,13 @@
final URIAuthority host6 = new URIAuthority("user", "SomeHost", 80);
final URIAuthority host7 = new URIAuthority("user", "somehost", 80);
- Assert.assertTrue(host1.hashCode() == host1.hashCode());
+ Assert.assertEquals(host1.hashCode(), host1.hashCode());
Assert.assertTrue(host1.hashCode() != host2.hashCode());
Assert.assertTrue(host1.hashCode() != host3.hashCode());
- Assert.assertTrue(host2.hashCode() == host4.hashCode());
- Assert.assertTrue(host2.hashCode() == host5.hashCode());
+ Assert.assertEquals(host2.hashCode(), host4.hashCode());
+ Assert.assertEquals(host2.hashCode(), host5.hashCode());
Assert.assertTrue(host5.hashCode() != host6.hashCode());
- Assert.assertTrue(host6.hashCode() == host7.hashCode());
+ Assert.assertEquals(host6.hashCode(), host7.hashCode());
}
@Test
@@ -86,13 +86,13 @@
final URIAuthority host6 = new URIAuthority("user", "SomeHost", 80);
final URIAuthority host7 = new URIAuthority("user", "somehost", 80);
- Assert.assertTrue(host1.equals(host1));
- Assert.assertFalse(host1.equals(host2));
- Assert.assertFalse(host1.equals(host3));
- Assert.assertTrue(host2.equals(host4));
- Assert.assertTrue(host2.equals(host5));
- Assert.assertFalse(host5.equals(host6));
- Assert.assertTrue(host6.equals(host7));
+ Assert.assertEquals(host1, host1);
+ Assert.assertNotEquals(host1, host2);
+ Assert.assertNotEquals(host1, host3);
+ Assert.assertEquals(host2, host4);
+ Assert.assertEquals(host2, host5);
+ Assert.assertNotEquals(host5, host6);
+ Assert.assertEquals(host6, host7);
}
@Test
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/pool/TestLaxConnPool.java b/httpcore5/src/test/java/org/apache/hc/core5/pool/TestLaxConnPool.java
index fd071c7..64242f2 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/pool/TestLaxConnPool.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/pool/TestLaxConnPool.java
@@ -183,7 +183,7 @@
Assert.assertTrue(future8.isDone());
final PoolEntry<String, HttpConnection> entry8 = future8.get();
Assert.assertNotNull(entry8);
- Assert.assertEquals(null, entry8.getConnection());
+ Assert.assertNull(entry8.getConnection());
Assert.assertTrue(future9.isDone());
final PoolEntry<String, HttpConnection> entry9 = future9.get();
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/pool/TestStrictConnPool.java b/httpcore5/src/test/java/org/apache/hc/core5/pool/TestStrictConnPool.java
index 2258254..72be5ee 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/pool/TestStrictConnPool.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/pool/TestStrictConnPool.java
@@ -192,7 +192,7 @@
Assert.assertTrue(future8.isDone());
final PoolEntry<String, HttpConnection> entry8 = future8.get();
Assert.assertNotNull(entry8);
- Assert.assertEquals(null, entry8.getConnection());
+ Assert.assertNull(entry8.getConnection());
Assert.assertTrue(future9.isDone());
final PoolEntry<String, HttpConnection> entry9 = future9.get();
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/reactor/IOReactorConfigTest.java b/httpcore5/src/test/java/org/apache/hc/core5/reactor/IOReactorConfigTest.java
index 03f398a..2bb9a87 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/reactor/IOReactorConfigTest.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/reactor/IOReactorConfigTest.java
@@ -56,10 +56,10 @@
Assert.assertEquals(TimeValue.ofMilliseconds(500), reactorConfig.getSelectInterval());
Assert.assertEquals(2, reactorConfig.getIoThreadCount());
Assert.assertEquals(Timeout.ofSeconds(10), reactorConfig.getSoTimeout());
- Assert.assertEquals(true, reactorConfig.isSoReuseAddress());
+ Assert.assertTrue(reactorConfig.isSoReuseAddress());
Assert.assertEquals(TimeValue.ofSeconds(30), reactorConfig.getSoLinger());
- Assert.assertEquals(true, reactorConfig.isSoKeepalive());
- Assert.assertEquals(false, reactorConfig.isTcpNoDelay());
+ Assert.assertTrue(reactorConfig.isSoKeepalive());
+ Assert.assertFalse(reactorConfig.isTcpNoDelay());
Assert.assertEquals(0x02, reactorConfig.getTrafficClass());
Assert.assertEquals(32767, reactorConfig.getSndBufSize());
Assert.assertEquals(8192, reactorConfig.getRcvBufSize());
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/util/TestLangUtils.java b/httpcore5/src/test/java/org/apache/hc/core5/util/TestLangUtils.java
index b9aa571..df39f1a 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/util/TestLangUtils.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/util/TestLangUtils.java
@@ -41,14 +41,14 @@
final Integer i = Integer.valueOf(1234);
final int h1 = LangUtils.hashCode(LangUtils.HASH_SEED, i.hashCode());
final int h2 = LangUtils.hashCode(LangUtils.HASH_SEED, i);
- Assert.assertTrue(h1 == h2);
+ Assert.assertEquals(h1, h2);
}
@Test
public void testNullObjectHash() {
final int h1 = LangUtils.hashCode(LangUtils.HASH_SEED, null);
final int h2 = LangUtils.hashCode(LangUtils.HASH_SEED, 0);
- Assert.assertTrue(h1 == h2);
+ Assert.assertEquals(h1, h2);
}
@Test
@@ -58,8 +58,8 @@
final int h3 = LangUtils.hashCode(LangUtils.HASH_SEED, true);
final int h4 = LangUtils.hashCode(LangUtils.HASH_SEED, false);
Assert.assertTrue(h1 != h2);
- Assert.assertTrue(h1 == h3);
- Assert.assertTrue(h2 == h4);
+ Assert.assertEquals(h1, h3);
+ Assert.assertEquals(h2, h4);
}
@Test
diff --git a/httpcore5/src/test/java/org/apache/hc/core5/util/TestTextUtils.java b/httpcore5/src/test/java/org/apache/hc/core5/util/TestTextUtils.java
index 5356a1d..5f05f97 100644
--- a/httpcore5/src/test/java/org/apache/hc/core5/util/TestTextUtils.java
+++ b/httpcore5/src/test/java/org/apache/hc/core5/util/TestTextUtils.java
@@ -64,7 +64,7 @@
@Test
public void testToHexString() {
Assert.assertEquals("000c2001ff", TextUtils.toHexString(new byte[] { 0, 12, 32, 1 , -1}));
- Assert.assertEquals(null, TextUtils.toHexString(null));
+ Assert.assertNull(TextUtils.toHexString(null));
}
}