use of feign.Contract in project feign by OpenFeign.
the class WhatShouldWeCacheBenchmarks method setup.
@Setup
public void setup() {
feignContract = new Contract.Default();
cachedContact = new Contract() {
private final List<MethodMetadata> cached = new Default().parseAndValidatateMetadata(FeignTestInterface.class);
public List<MethodMetadata> parseAndValidatateMetadata(Class<?> declaring) {
return cached;
}
};
fakeClient = new Client() {
public Response execute(Request request, Request.Options options) throws IOException {
Map<String, Collection<String>> headers = new LinkedHashMap<String, Collection<String>>();
return Response.create(200, "ok", headers, (byte[]) null);
}
};
cachedFakeFeign = Feign.builder().client(fakeClient).build();
cachedFakeApi = cachedFakeFeign.newInstance(new HardCodedTarget<FeignTestInterface>(FeignTestInterface.class, "http://localhost"));
}
Aggregations