diff --git a/unirest-bdd-tests/src/test/java/BehaviorTests/TimeoutTest.java b/unirest-bdd-tests/src/test/java/BehaviorTests/TimeoutTest.java index fca8d0ef..aafaf9b4 100644 --- a/unirest-bdd-tests/src/test/java/BehaviorTests/TimeoutTest.java +++ b/unirest-bdd-tests/src/test/java/BehaviorTests/TimeoutTest.java @@ -42,11 +42,14 @@ import static org.junit.jupiter.api.Assertions.*; -@Disabled + class TimeoutTest extends BddTest { @Test void requestTmeouts() { + // prime the server + Unirest.get(MockServer.GET).asEmpty(); + var ex = assertThrows(UnirestException.class, () -> { Unirest.get(MockServer.TIMEOUT) .requestTimeout(5) @@ -55,6 +58,20 @@ void requestTmeouts() { assertEquals(HttpTimeoutException.class, ex.getCause().getClass()); } + @Test + void requestTmeoutsViaGlobalConfig() { + // prime the server + Unirest.get(MockServer.GET).asEmpty(); + + Unirest.config().requestTimeout(5); + + var ex = assertThrows(UnirestException.class, () -> { + Unirest.get(MockServer.TIMEOUT) + .asString(); + }); + assertEquals(HttpTimeoutException.class, ex.getCause().getClass()); + } + @Test @Disabled void testSetTimeouts() { String address = MockServer.GET;