@Test public void testCreateCompanyCertNullData() { String expectedMessage = String.format("Missing the required body payload when calling %s", CREATE_COMPANY_CERT); String expectedSolution = String.format("Please check if the required body payload when calling %s exists", CREATE_COMPANY_CERT); when(logMessage.getMessage(INSTANCE_EMPTY, CREATE_COMPANY_CERT)).thenReturn( expectedMessage); when(logMessage.getMessage(INSTANCE_EMPTY_SOLUTION, CREATE_COMPANY_CERT)).thenReturn( expectedSolution); try { apiClient.createCompanyCert(MOCK_SESSION, null); fail(); } catch (RemoteApiException e) { assertEquals(400, e.getCode()); assertEquals(ExceptionMessageFormatter.format("Commons", expectedMessage, expectedSolution), e.getMessage()); } }
public CompanyCertDetail createCompanyCert(String sessionToken, CompanyCert cert) throws RemoteApiException { checkAuthToken(sessionToken); if (cert == null) { String reason = logMessage.getMessage(INSTANCE_EMPTY, CREATE_COMPANY_CERT); String solution = logMessage.getMessage(INSTANCE_EMPTY_SOLUTION, CREATE_COMPANY_CERT); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } String path = "/v2/companycert/create"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); return apiClient.doPost(path, headerParams, Collections.<String, String>emptyMap(), cert, CompanyCertDetail.class); }
SecurityApiClient extends BasePodApiClient { public CompanyCertDetail createCompanyCert(String sessionToken, CompanyCert cert) throws RemoteApiException { checkAuthToken(sessionToken); if (cert == null) { String reason = logMessage.getMessage(INSTANCE_EMPTY, CREATE_COMPANY_CERT); String solution = logMessage.getMessage(INSTANCE_EMPTY_SOLUTION, CREATE_COMPANY_CERT); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } String path = "/v2/companycert/create"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); return apiClient.doPost(path, headerParams, Collections.<String, String>emptyMap(), cert, CompanyCertDetail.class); } }
SecurityApiClient extends BasePodApiClient { public CompanyCertDetail createCompanyCert(String sessionToken, CompanyCert cert) throws RemoteApiException { checkAuthToken(sessionToken); if (cert == null) { String reason = logMessage.getMessage(INSTANCE_EMPTY, CREATE_COMPANY_CERT); String solution = logMessage.getMessage(INSTANCE_EMPTY_SOLUTION, CREATE_COMPANY_CERT); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } String path = "/v2/companycert/create"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); return apiClient.doPost(path, headerParams, Collections.<String, String>emptyMap(), cert, CompanyCertDetail.class); } SecurityApiClient(HttpApiClient apiClient, LogMessageSource logMessage); }
SecurityApiClient extends BasePodApiClient { public CompanyCertDetail createCompanyCert(String sessionToken, CompanyCert cert) throws RemoteApiException { checkAuthToken(sessionToken); if (cert == null) { String reason = logMessage.getMessage(INSTANCE_EMPTY, CREATE_COMPANY_CERT); String solution = logMessage.getMessage(INSTANCE_EMPTY_SOLUTION, CREATE_COMPANY_CERT); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } String path = "/v2/companycert/create"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); return apiClient.doPost(path, headerParams, Collections.<String, String>emptyMap(), cert, CompanyCertDetail.class); } SecurityApiClient(HttpApiClient apiClient, LogMessageSource logMessage); CompanyCertDetail createCompanyCert(String sessionToken, CompanyCert cert); }
SecurityApiClient extends BasePodApiClient { public CompanyCertDetail createCompanyCert(String sessionToken, CompanyCert cert) throws RemoteApiException { checkAuthToken(sessionToken); if (cert == null) { String reason = logMessage.getMessage(INSTANCE_EMPTY, CREATE_COMPANY_CERT); String solution = logMessage.getMessage(INSTANCE_EMPTY_SOLUTION, CREATE_COMPANY_CERT); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } String path = "/v2/companycert/create"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); return apiClient.doPost(path, headerParams, Collections.<String, String>emptyMap(), cert, CompanyCertDetail.class); } SecurityApiClient(HttpApiClient apiClient, LogMessageSource logMessage); CompanyCertDetail createCompanyCert(String sessionToken, CompanyCert cert);  }