Changeset 16677 in josm


Ignore:
Timestamp:
2020-06-17T23:38:10+02:00 (3 weeks ago)
Author:
simon04
Message:

Fix HttpClientTest: compare response message using equalToIgnoringCase

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/functional/org/openstreetmap/josm/tools/HttpClientTest.java

    r16633 r16677  
    66import static org.hamcrest.CoreMatchers.nullValue;
    77import static org.hamcrest.MatcherAssert.assertThat;
     8import static org.hamcrest.text.IsEqualIgnoringCase.equalToIgnoringCase;
    89import static org.junit.Assert.assertEquals;
    910import static org.junit.Assert.assertTrue;
     
    106107        assertThat(response.getRequestMethod(), is("GET"));
    107108        assertThat(response.getResponseCode(), is(200));
    108         assertThat(response.getResponseMessage(), is("OK"));
     109        assertThat(response.getResponseMessage(), equalToIgnoringCase("OK"));
    109110        assertThat(response.getContentType(), is("application/json"));
    110111        assertThat(response.getHeaderField("Content-Type"), is("application/json"));
     
    227228        final HttpClient.Response response = HttpClient.create(new URL("https://httpbin.org/status/418")).connect(progress);
    228229        assertThat(response.getResponseCode(), is(418));
    229         assertThat(response.getResponseMessage(), is("I'M A TEAPOT"));
    230230        final String content = response.fetchContent();
    231231        assertThat(content, containsString("-=[ teapot ]=-"));
     
    243243        final HttpClient.Response response = HttpClient.create(new URL("https://httpbin.org/status/401")).connect(progress);
    244244        assertThat(response.getResponseCode(), is(401));
    245         assertThat(response.getResponseMessage(), is("UNAUTHORIZED"));
     245        assertThat(response.getResponseMessage(), equalToIgnoringCase("UNAUTHORIZED"));
    246246        final String content = response.fetchContent();
    247247        assertThat(content, is(""));
     
    259259        final HttpClient.Response response = HttpClient.create(new URL("https://httpbin.org/status/402")).connect(progress);
    260260        assertThat(response.getResponseCode(), is(402));
    261         assertThat(response.getResponseMessage(), is("PAYMENT REQUIRED"));
     261        assertThat(response.getResponseMessage(), equalToIgnoringCase("PAYMENT REQUIRED"));
    262262        final String content = response.fetchContent();
    263263        assertThat(content, containsString("Fuck you, pay me!"));
     
    275275        final HttpClient.Response response = HttpClient.create(new URL("https://httpbin.org/status/403")).connect(progress);
    276276        assertThat(response.getResponseCode(), is(403));
    277         assertThat(response.getResponseMessage(), is("FORBIDDEN"));
     277        assertThat(response.getResponseMessage(), equalToIgnoringCase("FORBIDDEN"));
    278278        final String content = response.fetchContent();
    279279        assertThat(content, is(""));
     
    291291        final HttpClient.Response response = HttpClient.create(new URL("https://httpbin.org/status/404")).connect(progress);
    292292        assertThat(response.getResponseCode(), is(404));
    293         assertThat(response.getResponseMessage(), is("NOT FOUND"));
     293        assertThat(response.getResponseMessage(), equalToIgnoringCase("NOT FOUND"));
    294294        final String content = response.fetchContent();
    295295        assertThat(content, is(""));
     
    307307        final HttpClient.Response response = HttpClient.create(new URL("https://httpbin.org/status/500")).connect(progress);
    308308        assertThat(response.getResponseCode(), is(500));
    309         assertThat(response.getResponseMessage(), is("INTERNAL SERVER ERROR"));
     309        assertThat(response.getResponseMessage(), equalToIgnoringCase("INTERNAL SERVER ERROR"));
    310310        final String content = response.fetchContent();
    311311        assertThat(content, containsString(""));
Note: See TracChangeset for help on using the changeset viewer.