ErrorProcessingFilter implements ClientResponseFilter { @Override public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException { if (responseContext.getStatus() == SC_BAD_REQUEST) { throw new ClcBadRequestException(responseContext); } else if (responseContext.getStatus() >= 400) { throw new ClcHttpClientException(responseContext); } }  @Override void filter(ClientRequestContext requestContext, ClientResponseContext responseContext);  }
@Test(expectedExceptions = ClcBadRequestException.class) public void testIncorrectLogin() throws Throwable { SdkInjector .createInjector( SdkConfiguration.DEFAULT.asModule(), new AuthModule(new StaticCredentialsProvider("12345", "456789")) ) .getInstance(BearerAuthentication.class) .filter(Mockito.mock(ClientRequestContext.class)); }