RFR: 8252304: Seed an HttpRequest.Builder from an existing HttpRequest [v8]
Daniel Fuchs
dfuchs at openjdk.java.net
Tue Nov 17 16:53:07 UTC 2020
On Tue, 17 Nov 2020 16:16:53 GMT, Patrick Concannon <pconcannon at openjdk.org> wrote:
>> test/jdk/java/net/httpclient/HttpRequestNewBuilderTest.java line 320:
>>
>>> 318: @Test(dataProvider = "testRequests")
>>> 319: public void testRemoveHeader(HttpRequest request) {
>>> 320: BiPredicate<String, String> filter = (n, v) -> !n.equalsIgnoreCase("testName1");
>>
>> This assumes that there is at least one `request` such that `request.headers().firstValue("testName1").isPresent()` otherwise the test will trivially pass.
>> I wonder if we need a specific dataProvider here, so that we can assert:
>>
>> assertTrue(request.headers().firstValue("testName1").isPresent());
>>
>> first thing in the test? That - or have an AtomicInteger that counts how many time the original request has the conf we want to remove, and then assert that the counter > 0 in an `@AfterClass` method?
>
> Would it be enough to check in each test case that if we are examining a request with headers, it contains at least one called `testName1`? i.e.
> if(!request.headers().map().isEmpty())
> assertTrue(request.headers().map().containsKey("testName1"));
I will settle for that
-------------
PR: https://git.openjdk.java.net/jdk/pull/1059
More information about the net-dev
mailing list