### Question:
GitCredsResource implements ExploratoryAPI { @GET public ExploratoryGitCredsDTO getGitCreds(@Auth UserInfo userInfo) { return gitCredentialService.getGitCredentials(userInfo.getName()); } @Inject  GitCredsResource(GitCredentialService gitCredentialService); @PUT Response updateGitCreds(@Auth UserInfo userInfo,
								   @Valid @NotNull ExploratoryGitCredsDTO formDTO); @GET ExploratoryGitCredsDTO getGitCreds(@Auth UserInfo userInfo);  }### Answer:
@Test public void getGitCreds() { ExploratoryGitCredsDTO egcDto = getExploratoryGitCredsDTO(); when(gitCredentialService.getGitCredentials(anyString())).thenReturn(egcDto); final Response response = resources.getJerseyTest() .target("/user/git_creds") .request() .header("Authorization", "Bearer " + TOKEN) .get(); assertEquals(HttpStatus.SC_OK, response.getStatus()); assertEquals(egcDto.getGitCreds(), response.readEntity(ExploratoryGitCredsDTO.class).getGitCreds()); assertEquals(MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE)); verify(gitCredentialService).getGitCredentials(USER.toLowerCase()); verifyNoMoreInteractions(gitCredentialService); }
@Test public void getGitCredsWithFailedAuth() throws AuthenticationException { authFailSetup(); ExploratoryGitCredsDTO egcDto = getExploratoryGitCredsDTO(); when(gitCredentialService.getGitCredentials(anyString())).thenReturn(egcDto); final Response response = resources.getJerseyTest() .target("/user/git_creds") .request() .header("Authorization", "Bearer " + TOKEN) .get(); assertEquals(HttpStatus.SC_OK, response.getStatus()); assertEquals(egcDto.getGitCreds(), response.readEntity(ExploratoryGitCredsDTO.class).getGitCreds()); assertEquals(MediaType.APPLICATION_JSON, response.getHeaderString(HttpHeaders.CONTENT_TYPE)); verify(gitCredentialService).getGitCredentials(USER.toLowerCase()); verifyNoMoreInteractions(gitCredentialService); }