public static void rejectEmptyInput(Object[] input) { ValidationUtils.assertNotEmpty(input, "input"); }
/** * Constructs a new Composite Acceptor with the given list of acceptors. * Throws an assertion exception if the acceptor list is empty or null * * @param acceptors List of acceptors defined for each waiter. It shouldn't * be null or empty */ public CompositeAcceptor(List<WaiterAcceptor<Output>> acceptors) { this.acceptors = ValidationUtils.assertNotEmpty(acceptors, "acceptors"); }
public AndRetryCondition(RetryCondition... conditions) { Collections.addAll(this.conditions, assertNotEmpty(conditions, "conditions")); }
/** * Configure the list of authentication methods that should be used when authenticating against an HTTP proxy, in the order * they should be attempted. Any methods not included in this list will not be attempted. If one authentication method fails, * the next method will be attempted, until a working method is found (or all methods have been attempted). * * <p>Setting this value to null indicates using the default behavior, which is to try all authentication methods in an * unspecified order.</p> * * @param proxyAuthenticationMethods The proxy authentication methods to be attempted, in the order they should be attempted. */ public void setProxyAuthenticationMethods(List<ProxyAuthenticationMethod> proxyAuthenticationMethods) { if(proxyAuthenticationMethods == null) { this.proxyAuthenticationMethods = null; } else { ValidationUtils.assertNotEmpty(proxyAuthenticationMethods, "proxyAuthenticationMethods"); this.proxyAuthenticationMethods = Collections.unmodifiableList(new ArrayList<ProxyAuthenticationMethod>(proxyAuthenticationMethods)); } }
/** * Constructs a new Composite Acceptor with the given list of acceptors. * Throws an assertion exception if the acceptor list is empty or null * * @param acceptors List of acceptors defined for each waiter. It shouldn't * be null or empty */ public CompositeAcceptor(List<WaiterAcceptor<Output>> acceptors) { this.acceptors = ValidationUtils.assertNotEmpty(acceptors, "acceptors"); }
public AndRetryCondition(RetryCondition... conditions) { Collections.addAll(this.conditions, assertNotEmpty(conditions, "conditions")); }
/** * Configure the list of authentication methods that should be used when authenticating against an HTTP proxy, in the order * they should be attempted. Any methods not included in this list will not be attempted. If one authentication method fails, * the next method will be attempted, until a working method is found (or all methods have been attempted). * * <p>Setting this value to null indicates using the default behavior, which is to try all authentication methods in an * unspecified order.</p> * * @param proxyAuthenticationMethods The proxy authentication methods to be attempted, in the order they should be attempted. */ public void setProxyAuthenticationMethods(List<ProxyAuthenticationMethod> proxyAuthenticationMethods) { if(proxyAuthenticationMethods == null) { this.proxyAuthenticationMethods = null; } else { ValidationUtils.assertNotEmpty(proxyAuthenticationMethods, "proxyAuthenticationMethods"); this.proxyAuthenticationMethods = Collections.unmodifiableList(new ArrayList<ProxyAuthenticationMethod>(proxyAuthenticationMethods)); } }
@Test(expected = IllegalArgumentException.class) public void assertNotEmpty_EmptyCollection_ThrowsException() { final List<String> testList = new ArrayList<String>(); ValidationUtils.assertNotEmpty(testList, "testList"); }
@Test(expected = IllegalArgumentException.class) public void assertNotEmpty_NullArray_ThrowsException() { ValidationUtils.assertNotEmpty((String[]) null, "array"); }
@Test(expected = IllegalArgumentException.class) public void assertNotEmpty_NullCollection_ThrowsException() { ValidationUtils.assertNotEmpty((Collection<String>) null, "someCollection"); }
@Test(expected = IllegalArgumentException.class) public void assertNotEmpty_EmptyArray_ThrowsException() { ValidationUtils.assertNotEmpty(new String[0], "array"); }
@Test public void assertNotEmpty_NonNullCollection_ReturnsSameObject() { final List<String> testList = new ArrayList<String>(); testList.add("sample"); assertEquals(testList, ValidationUtils.assertNotEmpty(testList, "testList")); }
@Test public void assertNotEmpty_NonNullArray_ReturnsSameObject() { final String[] array = new String[] { "foo", "bar" }; assertArrayEquals(array, ValidationUtils.assertNotEmpty(array, "array")); }
public static void rejectEmptyInput(Object[] input) { ValidationUtils.assertNotEmpty(input, "input"); }
/** * Constructs a new Composite Acceptor with the given list of acceptors. * Throws an assertion exception if the acceptor list is empty or null * * @param acceptors List of acceptors defined for each waiter. It shouldn't * be null or empty */ public CompositeAcceptor(List<WaiterAcceptor<Output>> acceptors) { this.acceptors = ValidationUtils.assertNotEmpty(acceptors, "acceptors"); }
public AndRetryCondition(RetryCondition... conditions) { Collections.addAll(this.conditions, assertNotEmpty(conditions, "conditions")); }
/** * Configure the list of authentication methods that should be used when authenticating against an HTTP proxy, in the order * they should be attempted. Any methods not included in this list will not be attempted. If one authentication method fails, * the next method will be attempted, until a working method is found (or all methods have been attempted). * * <p>Setting this value to null indicates using the default behavior, which is to try all authentication methods in an * unspecified order.</p> * * @param proxyAuthenticationMethods The proxy authentication methods to be attempted, in the order they should be attempted. */ public void setProxyAuthenticationMethods(List<ProxyAuthenticationMethod> proxyAuthenticationMethods) { if(proxyAuthenticationMethods == null) { this.proxyAuthenticationMethods = null; } else { ValidationUtils.assertNotEmpty(proxyAuthenticationMethods, "proxyAuthenticationMethods"); this.proxyAuthenticationMethods = Collections.unmodifiableList(new ArrayList<ProxyAuthenticationMethod>(proxyAuthenticationMethods)); } }