Skip to content

Commit

Permalink
Fix assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
strangelookingnerd authored and ok2c committed Jun 27, 2024
1 parent 185d4e3 commit 420910d
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
package org.apache.hc.client5.http.impl.cache;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;

import org.apache.hc.core5.io.Closer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@


import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import java.io.ByteArrayInputStream;
Expand Down Expand Up @@ -170,7 +171,7 @@ void testStaleIfErrorInResponseYieldsToMustRevalidate()

final ClassicHttpResponse result = execute(req2);

assertTrue(HttpStatus.SC_OK != result.getCode());
assertNotEquals(HttpStatus.SC_OK, result.getCode());
}

@Test
Expand All @@ -193,7 +194,7 @@ void testStaleIfErrorInResponseYieldsToProxyRevalidateForSharedCache()

final ClassicHttpResponse result = execute(req2);

assertTrue(HttpStatus.SC_OK != result.getCode());
assertNotEquals(HttpStatus.SC_OK, result.getCode());
}

@Test
Expand All @@ -216,7 +217,7 @@ void testStaleIfErrorInResponseYieldsToExplicitFreshnessRequest()

final ClassicHttpResponse result = execute(req2);

assertTrue(HttpStatus.SC_OK != result.getCode());
assertNotEquals(HttpStatus.SC_OK, result.getCode());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ void testHopping() {
final HttpHost[] proxies3 = new HttpHost[]{ PROXY3, PROXY1, PROXY2 };
final HttpRoute route3 = new HttpRoute(TARGET1, LOCAL42, proxies3, false,
TunnelType.PLAIN, LayerType.LAYERED);
Assertions.assertEquals(route3.getHopCount(), 4, "C: hop count");
Assertions.assertEquals(4, route3.getHopCount(), "C: hop count");
Assertions.assertEquals(PROXY3 , route3.getHopTarget(0), "C: hop 0");
Assertions.assertEquals(PROXY1 , route3.getHopTarget(1), "C: hop 1");
Assertions.assertEquals(PROXY2 , route3.getHopTarget(2), "C: hop 2");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ void testOptionMethodGetAllowedMethods() {
final Set<String> methods = httpOptions.getAllowedMethods(response);
assertAll("Must all pass",
() -> assertFalse(methods.isEmpty()),
() -> assertEquals(methods.size(), 3),
() -> assertEquals(3, methods.size()),
() -> assertTrue(methods.containsAll(Stream.of("HEAD", "DELETE", "GET")
.collect(Collectors.toCollection(HashSet::new))))
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,9 +404,9 @@ void testPutSeeOtherRedirect() throws Exception {
final ClassicHttpRequest request2 = allValues.get(1);
final ClassicHttpRequest request3 = allValues.get(2);
Assertions.assertSame(request, request1);
Assertions.assertEquals(request1.getMethod(), "PUT");
Assertions.assertEquals(request2.getMethod(), "GET");
Assertions.assertEquals(request3.getMethod(), "GET");
Assertions.assertEquals("PUT", request1.getMethod());
Assertions.assertEquals("GET", request2.getMethod());
Assertions.assertEquals("GET", request3.getMethod());
}

private static class HttpRequestMatcher implements ArgumentMatcher<ClassicHttpRequest> {
Expand Down

0 comments on commit 420910d

Please sign in to comment.