On Tue, 17 Nov 2020 16:16:53 GMT, Patrick Concannon <[email protected]>
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