/**
* The type of a parameter value may not be the desired type to encode as. Prefer the interface
* type.
*/
@Test
public void bodyTypeCorrespondsWithParameterType() throws Exception {
server.enqueue(new MockResponse().setBody("foo"));
final AtomicReference<Type> encodedType = new AtomicReference<Type>();
TestInterface api = new TestInterfaceBuilder()
.encoder(new Encoder.Default() {
@Override
public void encode(Object object, Type bodyType, RequestTemplate template) {
encodedType.set(bodyType);
}
})
.target("http://localhost:" + server.getPort());
api.body(Arrays.asList("netflix", "denominator", "password"));
server.takeRequest();
assertThat(encodedType.get()).isEqualTo(new TypeToken<List<String>>() {
}.getType());
}
FeignTest.java 文件源码
java
阅读 23
收藏 0
点赞 0
评论 0
项目:XXXX
作者:
评论列表
文章目录