@Test(expectedExceptions = UnauthorizedException.class) public void testExecuteAndRetrieveBodyAndFailUnauthorized() throws Exception { Response<String> failure = createFailedResponse(401); doReturn(failure).when(call).execute(); doReturn(call).when(call).clone(); client.executeAndRetrieveBody(call, "failed"); }
protected <T> T executeAndRetrieveBody(Call<T> call, T defaultFailResponse) throws UnauthorizedException { return Optional.ofNullable(executeCallInternalRetryIfUnauthorized(call)) .map(Response::body) .orElse(defaultFailResponse); }
AbstractRemoteClient implements RemoteClient { protected <T> T executeAndRetrieveBody(Call<T> call, T defaultFailResponse) throws UnauthorizedException { return Optional.ofNullable(executeCallInternalRetryIfUnauthorized(call)) .map(Response::body) .orElse(defaultFailResponse); } }
AbstractRemoteClient implements RemoteClient { protected <T> T executeAndRetrieveBody(Call<T> call, T defaultFailResponse) throws UnauthorizedException { return Optional.ofNullable(executeCallInternalRetryIfUnauthorized(call)) .map(Response::body) .orElse(defaultFailResponse); } protected  AbstractRemoteClient(EndpointConnector connector, Class<S> cls); }
AbstractRemoteClient implements RemoteClient { protected <T> T executeAndRetrieveBody(Call<T> call, T defaultFailResponse) throws UnauthorizedException { return Optional.ofNullable(executeCallInternalRetryIfUnauthorized(call)) .map(Response::body) .orElse(defaultFailResponse); } protected  AbstractRemoteClient(EndpointConnector connector, Class<S> cls); boolean authenticate(); static String prefixTokenHeader(byte[] token, @Nonnull String prefix); S svc(); static char[] byteToCharArray(byte[] bytes); final EndpointConnector connector(); @Override String endpoint(); }
AbstractRemoteClient implements RemoteClient { protected <T> T executeAndRetrieveBody(Call<T> call, T defaultFailResponse) throws UnauthorizedException { return Optional.ofNullable(executeCallInternalRetryIfUnauthorized(call)) .map(Response::body) .orElse(defaultFailResponse); } protected  AbstractRemoteClient(EndpointConnector connector, Class<S> cls); boolean authenticate(); static String prefixTokenHeader(byte[] token, @Nonnull String prefix); S svc(); static char[] byteToCharArray(byte[] bytes); final EndpointConnector connector(); @Override String endpoint();  }