RFR: 8349135: Add tests for HttpRequest.Builder.copy() [v4]

Jaikiran Pai jpai at openjdk.org
Tue Feb 4 11:26:11 UTC 2025


On Tue, 4 Feb 2025 11:07:09 GMT, Volkan Yazici <vyazici at openjdk.org> wrote:

>> Adds `HttpRequest.Builder::copy` tests to `HttpRequestBuilderTest`.
>
> Volkan Yazici has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Replace `assert`s with explicit checks throwing `AssertionError`s

test/jdk/java/net/httpclient/HttpRequestBuilderTest.java line 270:

> 268:         HttpRequest defaultHeadReq = new NotOverriddenHEADImpl().HEAD().uri(TEST_URI).build();
> 269:         assertEquals("HEAD", defaultHeadReq.method(), "Method");
> 270:         assertEquals(defaultHeadReq.bodyPublisher().isEmpty(), false, "Body publisher absence");

The params here appear inverted. The first param to the method says "expected", so I think it should be:

assertEquals(false, defaultHeadReq.bodyPublisher().isEmpty(), "Body publisher absence");

test/jdk/java/net/httpclient/HttpRequestBuilderTest.java line 300:

> 298:                     + ". Unexpected body processor for GET: "
> 299:                     + request.bodyPublisher().get());
> 300:         assertEquals(method, expectedMethod, "Method");

Same here - This should be:


assertEquals(expectedMethod, method, "Method");

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/23415#discussion_r1940988132
PR Review Comment: https://git.openjdk.org/jdk/pull/23415#discussion_r1940988900


More information about the net-dev mailing list