Source:
<code>public void authenticateUserShouldReturnPromiseWithAuthenticationResponse() throws Exception { final AtomicReference<AuthenticationResponse> bodyRefResponse = new AtomicReference<>(); final AtomicReference<Request> bodyRefRequest = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); BitreserveClient bitreserveClient = new BitreserveClient("foobar"); BitreserveRestAdapter mockRestDapter = new BitreserveRestAdapter("foobar"); mockRestDapter.setAdapter(new RestAdapter.Builder().setEndpoint(GlobalConfigurations.SERVER_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { String responseString = "{" + "\"access_token\": \"foo\"," + "\"description\": \"bar\"," + "\"expires_in\": null" + "}"; bodyRefRequest.set(request); return new Response("some/url", 200, "reason", new ArrayList<Header>() {{ add(new retrofit.client.Header("foo", "bar")); }}, new TypedByteArray("application/json", responseString.getBytes())); } }).build()); bitreserveClient.getToken().setBitreserveRestAdapter(mockRestDapter); bitreserveClient.authenticateUser("otp", "user", "password", new AuthenticationRequest("description")).then(new PromiseAction<AuthenticationResponse>() { @Override public void call(AuthenticationResponse authenticationResponse) { bodyRefResponse.set(authenticationResponse); latch.countDown(); } }).fail(new PromiseAction<Exception>() { @Override public void call(Exception e) { latch.countDown(); } }); latch.await(); AuthenticationResponse authenticationResponse = bodyRefResponse.get(); Request request = bodyRefRequest.get(); Assert.assertEquals(authenticationResponse.getAccessToken(), "foo"); Assert.assertEquals(authenticationResponse.getDescription(), "bar"); <START> Assert.assertEquals(authenticationResponse.getExpiresIn(), null); <END> Assert.assertEquals(request.getHeaders().get(0).getName(), "X-Bitreserve-OTP"); Assert.assertEquals(request.getHeaders().get(0).getValue(), "otp"); Assert.assertEquals(request.getHeaders().get(1).getName(), "Authorization"); Assert.assertEquals(request.getHeaders().get(1).getValue(), "Basic dXNlcjpwYXNzd29yZA=="); Assert.assertEquals(request.getMethod(), "POST"); Assert.assertEquals(request.getUrl(), "<LINK_0>"); }</code><technical_language>Change assertNull</technical_language>

Target:
public void authenticateUserShouldReturnPromiseWithAuthenticationResponse() throws Exception { final AtomicReference<AuthenticationResponse> bodyRefResponse = new AtomicReference<>(); final AtomicReference<Request> bodyRefRequest = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); BitreserveClient bitreserveClient = new BitreserveClient("foobar"); BitreserveRestAdapter mockRestDapter = new BitreserveRestAdapter("foobar"); mockRestDapter.setAdapter(new RestAdapter.Builder().setEndpoint(GlobalConfigurations.SERVER_URL).setClient(new Client() { @Override public Response execute(Request request) throws IOException { String responseString = "{" + "\"access_token\": \"foo\"," + "\"description\": \"bar\"," + "\"expires_in\": null" + "}"; bodyRefRequest.set(request); return new Response("some/url", 200, "reason", new ArrayList<Header>() {{ add(new retrofit.client.Header("foo", "bar")); }}, new TypedByteArray("application/json", responseString.getBytes())); } }).build()); bitreserveClient.getToken().setBitreserveRestAdapter(mockRestDapter); bitreserveClient.authenticateUser("otp", "user", "password", new AuthenticationRequest("description")).then(new PromiseAction<AuthenticationResponse>() { @Override public void call(AuthenticationResponse authenticationResponse) { bodyRefResponse.set(authenticationResponse); latch.countDown(); } }).fail(new PromiseAction<Exception>() { @Override public void call(Exception e) { latch.countDown(); } }); latch.await(); AuthenticationResponse authenticationResponse = bodyRefResponse.get(); Request request = bodyRefRequest.get(); Assert.assertEquals(authenticationResponse.getAccessToken(), "foo"); Assert.assertEquals(authenticationResponse.getDescription(), "bar"); Assert.assertNull(authenticationResponse.getExpiresIn()); Assert.assertEquals(request.getHeaders().get(0).getName(), "X-Bitreserve-OTP"); Assert.assertEquals(request.getHeaders().get(0).getValue(), "otp"); Assert.assertEquals(request.getHeaders().get(1).getName(), "Authorization"); Assert.assertEquals(request.getHeaders().get(1).getValue(), "Basic dXNlcjpwYXNzd29yZA=="); Assert.assertEquals(request.getMethod(), "POST"); Assert.assertEquals(request.getUrl(), "<LINK_0>"); }