### Question:
AuthorizationServer { protected ClientCredentials getActiveClientCredentials(String clientId) { ClientCredentials creds = db.findClientCredentials(clientId); if (creds != null && creds.getStatus() == ClientCredentials.ACTIVE_STATUS) { return creds; } return null; }  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_valid_client_id_and_active_status_return_true() throws Exception { ClientCredentials creds = mock(ClientCredentials.class); given(creds.getStatus()).willReturn(ClientCredentials.ACTIVE_STATUS); given(authServer.db.findClientCredentials(clientId)).willReturn(creds); ClientCredentials result = authServer.getActiveClientCredentials(clientId); assertNotNull(result); }
@Test public void when_valid_client_id_and_inactive_status_return_null() throws Exception { ClientCredentials creds = mock(ClientCredentials.class); given(creds.getStatus()).willReturn(ClientCredentials.INACTIVE_STATUS); given(authServer.db.findClientCredentials(clientId)).willReturn(creds); ClientCredentials result = authServer.getActiveClientCredentials(clientId); assertNull(result); }
@Test public void when_not_valid_client_id_return_null() throws Exception { String clienId = "203598599234220"; ClientCredentials result = authServer.getActiveClientCredentials(clientId); assertNull(result); }