private void checkGeneralPreconditions(String host, int port, int timeoutInMs, ErrorHandler errorHandler) { Preconditions.checkNotNullOrEmpty(host, "host is null or empty"); Preconditions.checkGreaterThanZero(port, "port is not a positive number"); Preconditions.checkGreaterThanZero(timeoutInMs, "timeoutInMs is not a positive number"); Preconditions.checkNotNull(errorHandler, "errorHandler is null"); }
@Test(expected = IllegalArgumentException.class) public void shouldThrowAnExceptionWhenStringIsNull() { Preconditions.checkNotNullOrEmpty(null, MSG_STRING_IS_NULL); }
@Test public void shouldNotThrowAnythingWhenStringIsNotEmpty() { Preconditions.checkNotNullOrEmpty("notEmpty", MSG_STRING_IS_NULL); }
@Test(expected = IllegalArgumentException.class) public void shouldThrowAnExceptionWhenStringIsEmpty() { Preconditions.checkNotNullOrEmpty("", MSG_STRING_IS_NULL); }
private void checkGeneralPreconditions(final String host, final int port, final int timeoutInMs, final int httpResponse, final ErrorHandler errorHandler) { Preconditions.checkNotNullOrEmpty(host, "host is null or empty"); Preconditions.checkGreaterThanZero(port, "port is not a positive number"); Preconditions.checkGreaterThanZero(timeoutInMs, "timeoutInMs is not a positive number"); Preconditions.checkNotNull(errorHandler, "errorHandler is null"); Preconditions.checkNotNull(httpResponse, "httpResponse is null"); Preconditions.checkGreaterThanZero(httpResponse, "httpResponse is not a positive number"); }