|
|
@ -29,10 +29,19 @@ import static org.assertj.core.api.Assertions.assertThat; |
|
|
|
@SuppressWarnings("deprecation") |
|
|
|
@SuppressWarnings("deprecation") |
|
|
|
public class OptionsTest { |
|
|
|
public class OptionsTest { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static class ChildOptions extends Request.Options { |
|
|
|
|
|
|
|
public ChildOptions(int connectTimeoutMillis, int readTimeoutMillis) { |
|
|
|
|
|
|
|
super(connectTimeoutMillis, readTimeoutMillis); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
interface OptionsInterface { |
|
|
|
interface OptionsInterface { |
|
|
|
@RequestLine("GET /") |
|
|
|
@RequestLine("GET /") |
|
|
|
String get(Request.Options options); |
|
|
|
String get(Request.Options options); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestLine("POST /") |
|
|
|
|
|
|
|
String getChildOptions(ChildOptions options); |
|
|
|
|
|
|
|
|
|
|
|
@RequestLine("GET /") |
|
|
|
@RequestLine("GET /") |
|
|
|
String get(); |
|
|
|
String get(); |
|
|
|
} |
|
|
|
} |
|
|
@ -66,4 +75,16 @@ public class OptionsTest { |
|
|
|
|
|
|
|
|
|
|
|
assertThat(api.get(new Request.Options(1000, 4 * 1000))).isEqualTo("foo"); |
|
|
|
assertThat(api.get(new Request.Options(1000, 4 * 1000))).isEqualTo("foo"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Test |
|
|
|
|
|
|
|
public void normalResponseForChildOptionsTest() { |
|
|
|
|
|
|
|
final MockWebServer server = new MockWebServer(); |
|
|
|
|
|
|
|
server.enqueue(new MockResponse().setBody("foo").setBodyDelay(3, TimeUnit.SECONDS)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final OptionsInterface api = Feign.builder() |
|
|
|
|
|
|
|
.options(new ChildOptions(1000, 1000)) |
|
|
|
|
|
|
|
.target(OptionsInterface.class, server.url("/").toString()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
assertThat(api.getChildOptions(new ChildOptions(1000, 4 * 1000))).isEqualTo("foo"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|