### Question:
AuthorizationServer { protected boolean isExistingClient(String clientId) { ClientCredentials creds = db.findClientCredentials(clientId); if (creds != null) { return true; } return false; }  ClientCredentials issueClientCredentials(HttpRequest req); String issueAuthorizationCode(HttpRequest req); AccessToken issueAccessToken(HttpRequest req); static String [] getBasicAuthorizationClientCredentials(HttpRequest req); AccessToken isValidToken(String token); ApplicationInfo getApplicationInfo(String clientId); boolean revokeUserAccessTokens(HttpRequest req); boolean revokeToken(HttpRequest req); boolean updateClientApp(HttpRequest req, String clientId);  }### Answer:
@Test public void when_client_id_exists_return_true() throws Exception { willReturn(mock(ClientCredentials.class)).given(authServer.db).findClientCredentials(clientId); boolean result = authServer.isExistingClient(clientId); assertTrue(result); }
@Test public void when_client_id_does_not_exist_return_false() throws Exception { willReturn(null).given(authServer.db).findClientCredentials(clientId); boolean result = authServer.isExistingClient(clientId); assertFalse(result); }