AuthRestApi extends ApiBase implements AuthApi { @Override public void getAuthStatusAsync(final FutureCallback<Auth> responseCallback) throws IOException { String path = getBasePath(); getObjectByPathAsync(path, responseCallback, new TypeReference<Auth>() { }); } AuthRestApi(RestClient restClient); @Override String getBasePath(); @Override Auth getAuthStatus(); @Override void getAuthStatusAsync(final FutureCallback<Auth> responseCallback);  }
@Test public void testGetAuthStatusAsync() throws IOException, InterruptedException { final Auth auth = new Auth(); ObjectMapper mapper = new ObjectMapper(); String serialized = mapper.writeValueAsString(auth); setupMocks(serialized, HttpStatus.SC_OK); AuthApi authApi = new AuthRestApi(restClient); final CountDownLatch latch = new CountDownLatch(1); authApi.getAuthStatusAsync(new FutureCallback<Auth>() { @Override public void onSuccess(@Nullable Auth result) { assertEquals(result, auth); latch.countDown(); } @Override public void onFailure(Throwable t) { fail(t.toString()); latch.countDown(); } }); }