use of com.palantir.dialogue.UrlBuilder in project dialogue by palantir.
the class UserAgentEndpointChannelTest method testServiceNameIsNotValidConjureAgent.
@Test
public void testServiceNameIsNotValidConjureAgent() {
EndpointChannel channel = UserAgentEndpointChannel.create(delegate, new Endpoint() {
@Override
public void renderPath(Map<String, String> _params, UrlBuilder _url) {
}
@Override
public HttpMethod httpMethod() {
return HttpMethod.GET;
}
@Override
public String serviceName() {
return "Service_Name";
}
@Override
public String endpointName() {
return "endpoint";
}
@Override
public String version() {
return "4.5.6";
}
}, baseAgent);
// Special case: In IDEs, tests are run against classes (not JARs) and thus don't carry versions.
String dialogueVersion = Optional.ofNullable(Channel.class.getPackage().getImplementationVersion()).orElse("0.0.0");
channel.execute(request);
verify(delegate).execute(requestCaptor.capture());
assertThat(requestCaptor.getValue().headerParams().get("user-agent")).containsExactly("test-class/1.2.3 dialogue/" + dialogueVersion);
}
Aggregations