@Test public void testPostMessageNullKMToken() { try { apiClient.validateParams(MOCK_SESSION, null, null, null); fail(); } catch (RemoteApiException e) { assertEquals(400, e.getCode()); verify(logMessage).getMessage(MISSING_PARAMETER, KM_TOKEN_HEADER_PARAM); } }
protected void validateParams(String sessionToken, String kmToken, String streamId, Message message) throws RemoteApiException { if (sessionToken == null) { String exception = logMessage.getMessage(MISSING_PARAMETER, SESSION_TOKEN_HEADER_PARAM); String solution = logMessage.getMessage(MISSING_PARAMETER_SOLUTION); throw new RemoteApiException(400, exception, solution); } if (kmToken == null) { String exception = logMessage.getMessage(MISSING_PARAMETER, KM_TOKEN_HEADER_PARAM); String solution = logMessage.getMessage(MISSING_PARAMETER_SOLUTION); throw new RemoteApiException(400, exception, solution); } if (streamId == null) { String exception = logMessage.getMessage(MISSING_PARAMETER, STREAM_ID_PATH); String solution = logMessage.getMessage(MISSING_STREAMID_SOLUTION); throw new RemoteApiException(400, exception, solution); } if (message == null) { String exception = logMessage.getMessage(MISSING_BODY); String solution = logMessage.getMessage(MISSING_BODY_SOLUTION); throw new RemoteApiException(400, exception, solution); } }
BaseMessageApiClient implements MessageApiClient { protected void validateParams(String sessionToken, String kmToken, String streamId, Message message) throws RemoteApiException { if (sessionToken == null) { String exception = logMessage.getMessage(MISSING_PARAMETER, SESSION_TOKEN_HEADER_PARAM); String solution = logMessage.getMessage(MISSING_PARAMETER_SOLUTION); throw new RemoteApiException(400, exception, solution); } if (kmToken == null) { String exception = logMessage.getMessage(MISSING_PARAMETER, KM_TOKEN_HEADER_PARAM); String solution = logMessage.getMessage(MISSING_PARAMETER_SOLUTION); throw new RemoteApiException(400, exception, solution); } if (streamId == null) { String exception = logMessage.getMessage(MISSING_PARAMETER, STREAM_ID_PATH); String solution = logMessage.getMessage(MISSING_STREAMID_SOLUTION); throw new RemoteApiException(400, exception, solution); } if (message == null) { String exception = logMessage.getMessage(MISSING_BODY); String solution = logMessage.getMessage(MISSING_BODY_SOLUTION); throw new RemoteApiException(400, exception, solution); } } }
BaseMessageApiClient implements MessageApiClient { protected void validateParams(String sessionToken, String kmToken, String streamId, Message message) throws RemoteApiException { if (sessionToken == null) { String exception = logMessage.getMessage(MISSING_PARAMETER, SESSION_TOKEN_HEADER_PARAM); String solution = logMessage.getMessage(MISSING_PARAMETER_SOLUTION); throw new RemoteApiException(400, exception, solution); } if (kmToken == null) { String exception = logMessage.getMessage(MISSING_PARAMETER, KM_TOKEN_HEADER_PARAM); String solution = logMessage.getMessage(MISSING_PARAMETER_SOLUTION); throw new RemoteApiException(400, exception, solution); } if (streamId == null) { String exception = logMessage.getMessage(MISSING_PARAMETER, STREAM_ID_PATH); String solution = logMessage.getMessage(MISSING_STREAMID_SOLUTION); throw new RemoteApiException(400, exception, solution); } if (message == null) { String exception = logMessage.getMessage(MISSING_BODY); String solution = logMessage.getMessage(MISSING_BODY_SOLUTION); throw new RemoteApiException(400, exception, solution); } } BaseMessageApiClient(LogMessageSource logMessage); }
BaseMessageApiClient implements MessageApiClient { protected void validateParams(String sessionToken, String kmToken, String streamId, Message message) throws RemoteApiException { if (sessionToken == null) { String exception = logMessage.getMessage(MISSING_PARAMETER, SESSION_TOKEN_HEADER_PARAM); String solution = logMessage.getMessage(MISSING_PARAMETER_SOLUTION); throw new RemoteApiException(400, exception, solution); } if (kmToken == null) { String exception = logMessage.getMessage(MISSING_PARAMETER, KM_TOKEN_HEADER_PARAM); String solution = logMessage.getMessage(MISSING_PARAMETER_SOLUTION); throw new RemoteApiException(400, exception, solution); } if (streamId == null) { String exception = logMessage.getMessage(MISSING_PARAMETER, STREAM_ID_PATH); String solution = logMessage.getMessage(MISSING_STREAMID_SOLUTION); throw new RemoteApiException(400, exception, solution); } if (message == null) { String exception = logMessage.getMessage(MISSING_BODY); String solution = logMessage.getMessage(MISSING_BODY_SOLUTION); throw new RemoteApiException(400, exception, solution); } } BaseMessageApiClient(LogMessageSource logMessage);  }
BaseMessageApiClient implements MessageApiClient { protected void validateParams(String sessionToken, String kmToken, String streamId, Message message) throws RemoteApiException { if (sessionToken == null) { String exception = logMessage.getMessage(MISSING_PARAMETER, SESSION_TOKEN_HEADER_PARAM); String solution = logMessage.getMessage(MISSING_PARAMETER_SOLUTION); throw new RemoteApiException(400, exception, solution); } if (kmToken == null) { String exception = logMessage.getMessage(MISSING_PARAMETER, KM_TOKEN_HEADER_PARAM); String solution = logMessage.getMessage(MISSING_PARAMETER_SOLUTION); throw new RemoteApiException(400, exception, solution); } if (streamId == null) { String exception = logMessage.getMessage(MISSING_PARAMETER, STREAM_ID_PATH); String solution = logMessage.getMessage(MISSING_STREAMID_SOLUTION); throw new RemoteApiException(400, exception, solution); } if (message == null) { String exception = logMessage.getMessage(MISSING_BODY); String solution = logMessage.getMessage(MISSING_BODY_SOLUTION); throw new RemoteApiException(400, exception, solution); } } BaseMessageApiClient(LogMessageSource logMessage);  static final String SESSION_TOKEN_HEADER_PARAM; static final String KM_TOKEN_HEADER_PARAM; static final String STREAM_ID_PATH; }