@Test public void testCreateIntegrationNullList() { String expectedMessage = String.format("Missing the required body payload when calling %s", CREATE_IM); String expectedSolution = String.format("Please check if the required body payload when calling %s exists", CREATE_IM); when(logMessage.getMessage(INSTANCE_EMPTY, CREATE_IM)).thenReturn( expectedMessage); when(logMessage.getMessage(INSTANCE_EMPTY_SOLUTION, CREATE_IM)).thenReturn( expectedSolution); try { apiClient.createIM(MOCK_SESSION, null); fail(); } catch (RemoteApiException e) { assertEquals(400, e.getCode()); assertEquals(ExceptionMessageFormatter.format("Commons", expectedMessage, expectedSolution), e.getMessage()); } }
public Stream createIM(String sessionToken, List<Long> uidList) throws RemoteApiException { checkAuthToken(sessionToken); if (uidList == null) { String reason = logMessage.getMessage(INSTANCE_EMPTY, CREATE_IM); String solution = logMessage.getMessage(INSTANCE_EMPTY_SOLUTION, CREATE_IM); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } String path = "/v1/im/create"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); return apiClient.doPost(path, headerParams, Collections.<String, String>emptyMap(), uidList, Stream.class); }
StreamApiClient extends BasePodApiClient { public Stream createIM(String sessionToken, List<Long> uidList) throws RemoteApiException { checkAuthToken(sessionToken); if (uidList == null) { String reason = logMessage.getMessage(INSTANCE_EMPTY, CREATE_IM); String solution = logMessage.getMessage(INSTANCE_EMPTY_SOLUTION, CREATE_IM); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } String path = "/v1/im/create"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); return apiClient.doPost(path, headerParams, Collections.<String, String>emptyMap(), uidList, Stream.class); } }
StreamApiClient extends BasePodApiClient { public Stream createIM(String sessionToken, List<Long> uidList) throws RemoteApiException { checkAuthToken(sessionToken); if (uidList == null) { String reason = logMessage.getMessage(INSTANCE_EMPTY, CREATE_IM); String solution = logMessage.getMessage(INSTANCE_EMPTY_SOLUTION, CREATE_IM); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } String path = "/v1/im/create"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); return apiClient.doPost(path, headerParams, Collections.<String, String>emptyMap(), uidList, Stream.class); } StreamApiClient(HttpApiClient apiClient, LogMessageSource logMessage); }
StreamApiClient extends BasePodApiClient { public Stream createIM(String sessionToken, List<Long> uidList) throws RemoteApiException { checkAuthToken(sessionToken); if (uidList == null) { String reason = logMessage.getMessage(INSTANCE_EMPTY, CREATE_IM); String solution = logMessage.getMessage(INSTANCE_EMPTY_SOLUTION, CREATE_IM); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } String path = "/v1/im/create"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); return apiClient.doPost(path, headerParams, Collections.<String, String>emptyMap(), uidList, Stream.class); } StreamApiClient(HttpApiClient apiClient, LogMessageSource logMessage); Stream createIM(String sessionToken, List<Long> uidList); }
StreamApiClient extends BasePodApiClient { public Stream createIM(String sessionToken, List<Long> uidList) throws RemoteApiException { checkAuthToken(sessionToken); if (uidList == null) { String reason = logMessage.getMessage(INSTANCE_EMPTY, CREATE_IM); String solution = logMessage.getMessage(INSTANCE_EMPTY_SOLUTION, CREATE_IM); throw new RemoteApiException(HTTP_BAD_REQUEST_ERROR, reason, solution); } String path = "/v1/im/create"; Map<String, String> headerParams = new HashMap<>(); headerParams.put(SESSION_TOKEN_HEADER_PARAM, sessionToken); return apiClient.doPost(path, headerParams, Collections.<String, String>emptyMap(), uidList, Stream.class); } StreamApiClient(HttpApiClient apiClient, LogMessageSource logMessage); Stream createIM(String sessionToken, List<Long> uidList);  }