use of com.lonepulse.robozombie.request.Interceptor in project RoboZombie by sahan.
the class InterceptorEndpointTest method testParamInterceptor.
/**
* <p>Test for {@link Interceptor}s passed as a request parameters.</p>
*
* @since 1.3.0
*/
@Test
public final void testParamInterceptor() {
Robolectric.getFakeHttpLayer().interceptHttpRequests(false);
String subpath = "/param";
stubFor(get(urlEqualTo(subpath)).willReturn(aResponse().withStatus(200)));
final String value = "param";
interceptorEndpoint.paramInterceptor(new Interceptor() {
public void intercept(InvocationContext context, HttpRequestBase request) {
request.addHeader("X-Header", value);
}
});
verify(getRequestedFor(urlEqualTo(subpath)).withHeader("X-Header", equalTo("endpoint")).withHeader("X-Header", equalTo("request")).withHeader("X-Header", equalTo(value)).withHeader("Accept-Charset", equalTo("utf-8")));
}
Aggregations