### Question:
AuthorizationServer { public ApplicationInfo getApplicationInfo(String clientId) { ApplicationInfo appInfo = null; ClientCredentials creds = db.findClientCredentials(clientId); if (creds != null) { appInfo = ApplicationInfo.loadFromClientCredentials(creds); } return appInfo; }  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_is_registered_return_app_name() throws Exception { String clientId = "740503633355700"; String appName = "TestDemoApp"; ClientCredentials creds = mock(ClientCredentials.class); given(creds.getId()).willReturn(clientId); given(creds.getName()).willReturn(appName); given(authServer.db.findClientCredentials(clientId)).willReturn(creds); ApplicationInfo result = authServer.getApplicationInfo(clientId); assertEquals(result.getName(), appName); }
@Test public void when_client_is_not_registered_return_null_app_name() throws Exception { String clientId = "not_registered_client_id"; ApplicationInfo result = authServer.getApplicationInfo(clientId); assertNull(result); }