diff --git a/src/main/java/com/bryanjswift/simplenote/net/SimplenoteApi.java b/src/main/java/com/bryanjswift/simplenote/net/SimplenoteApi.java index d803a92..a7021e7 100644 --- a/src/main/java/com/bryanjswift/simplenote/net/SimplenoteApi.java +++ b/src/main/java/com/bryanjswift/simplenote/net/SimplenoteApi.java @@ -166,7 +166,7 @@ public ApiResponse login(final String email, final String password) if (response.status == HttpStatus.SC_OK) { result = new ApiResponse(response.status, new Credentials(response.payload, email), response.headers); } else { - result = new ApiResponse(response.status, null, response.headers); + result = new ApiResponse(response.status, new Credentials(null, email, password), response.headers); } return result; } diff --git a/src/test/scala/SimplenoteApiSpec.scala b/src/test/scala/SimplenoteApiSpec.scala index f5ea363..c39a2a9 100644 --- a/src/test/scala/SimplenoteApiSpec.scala +++ b/src/test/scala/SimplenoteApiSpec.scala @@ -27,7 +27,8 @@ class SimplenoteApiSpec extends WordSpec with ShouldMatchers { val response = unauthorized.login(badCredentials.email, badCredentials.password) response.status should not be (HttpStatus.SC_UNAUTHORIZED) response.payload.email should be (badCredentials.email) - response.payload.password should be (null) + response.payload.password should be (badCredentials.password) + response.payload should be (badCredentials) } }