### Question:
AuthorizationServer { protected boolean isActiveClient(String clientId, String clientSecret) { ClientCredentials creds = db.findClientCredentials(clientId); if (creds != null && creds.getSecret().equals(clientSecret) && creds.getStatus() == ClientCredentials.ACTIVE_STATUS) { 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_app_status_is_inactive_return_validClientCredentials_false() throws Exception { String clientId = "203598599234220"; String clientSecret = "f754cb0cd78c4c36fa3c1c0325ef72bb4a011373"; ClientCredentials client = mock(ClientCredentials.class); willReturn(ClientCredentials.INACTIVE_STATUS).given(client).getStatus(); willReturn(clientSecret).given(client).getSecret(); willReturn(client).given(authServer.db).findClientCredentials(clientId); boolean valid = authServer.isActiveClient(clientId, clientSecret); assertFalse(valid); }
@Test public void when_client_app_status_is_active_return_validClientCredentials_true() throws Exception { String clientId = "203598599234220"; String clientSecret = "f754cb0cd78c4c36fa3c1c0325ef72bb4a011373"; ClientCredentials client = mock(ClientCredentials.class); willReturn(ClientCredentials.ACTIVE_STATUS).given(client).getStatus(); willReturn(clientSecret).given(client).getSecret(); willReturn(client).given(authServer.db).findClientCredentials(clientId); boolean valid = authServer.isActiveClient(clientId, clientSecret); assertTrue(valid); }