Changeset 12555 in josm


Ignore:
Timestamp:
2017-08-02T02:00:24+02:00 (2 weeks ago)
Author:
Don-vip
Message:

see #15102 - speedup HttpClientTest by reducing delays and timeouts

File:
1 edited

Legend:

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

    r11250 r12555  
    5959    };
    6060
     61    /**
     62     * Setup test.
     63     */
    6164    @Before
    6265    public void setUp() {
     
    240243    }
    241244
    242 
     245    /**
     246     * Checks that a slow request is well handled if it completes before the timeout.
     247     * @throws IOException if any I/O error occurs
     248     */
    243249    @Test
    244250    public void testRequestInTime() throws IOException {
    245         final HttpClient.Response response = HttpClient.create(new URL("https://httpbin.org/delay/3")).setReadTimeout(3500).connect(progress);
    246         assertThat(response.getResponseCode(), is(200));
    247     }
    248 
     251        final HttpClient.Response response = HttpClient.create(new URL("https://httpbin.org/delay/1")).setReadTimeout(1500).connect(progress);
     252        assertThat(response.getResponseCode(), is(200));
     253    }
     254
     255    /**
     256     * Checks that a slow request results in the expected exception if it exceeds the timeout.
     257     * @throws IOException always
     258     */
    249259    @Test(expected = IOException.class)
    250260    public void testTakesTooLong() throws IOException {
    251         HttpClient.create(new URL("https://httpbin.org/delay/3")).setReadTimeout(2500).connect(progress);
     261        HttpClient.create(new URL("https://httpbin.org/delay/1")).setReadTimeout(500).connect(progress);
    252262    }
    253263
Note: See TracChangeset for help on using the changeset viewer.