/** * Create a property with 2 or more values. * * @param name the property name * @param values the property values * @throws IllegalArgumentException if the values is null or does not have at least 2 values */ public BasicMultiValueProperty( Name name, Object... values ) { super(name); CheckArg.isNotNull(values, "values"); CheckArg.hasSizeOfAtLeast(values, 2, "values"); this.values = Arrays.asList(values); }
/** * Create a property with 2 or more values. * * @param name the property name * @param values the property values * @throws IllegalArgumentException if the values is null or does not have at least 2 values */ public BasicMultiValueProperty( Name name, Object... values ) { super(name); CheckArg.isNotNull(values, "values"); CheckArg.hasSizeOfAtLeast(values, 2, "values"); this.values = Arrays.asList(values); }
/** * Create a property with 2 or more values. * * @param name the property name * @param values the property values * @throws IllegalArgumentException if the values is null or does not have at least 2 values */ public BasicMultiValueProperty( Name name, Object... values ) { super(name); CheckArg.isNotNull(values, "values"); CheckArg.hasSizeOfAtLeast(values, 2, "values"); this.values = Arrays.asList(values); }
/** * Create a property with 2 or more values. Note that the supplied list may be modifiable, as this object does not expose any * means for modifying the contents. * * @param name the property name * @param values the property values * @throws IllegalArgumentException if the values is null or does not have at least 2 values */ public BasicMultiValueProperty( Name name, List<Object> values ) { super(name); CheckArg.isNotNull(values, "values"); CheckArg.hasSizeOfAtLeast(values, 2, "values"); this.values = values; }
@Test public void hasSizeOfAtLeastShouldNotThrowExceptionIfMapSizeIsGreaterThanSuppliedValue() { CheckArg.hasSizeOfAtLeast(Collections.singletonMap("key", "value"), 0, "value"); }
@Test( expected = IllegalArgumentException.class ) public void hasSizeOfAtLeastShouldThrowExceptionIfCollectionSizeIsSmallerThanSuppliedValue() { CheckArg.hasSizeOfAtLeast(Collections.singletonList(" "), 2, "value"); }
@Test( expected = IllegalArgumentException.class ) public void hasSizeOfAtLeastShouldThrowExceptionIfMapSizeIsSmallerThanSuppliedValue() { CheckArg.hasSizeOfAtLeast(Collections.singletonMap("key", "value"), 2, "value"); }
@Test public void hasSizeOfAtLeastShouldNotThrowExceptionIfArraySizeIsEqualToSuppliedValue() { CheckArg.hasSizeOfAtLeast(new Object[] {"key", "value"}, 2, "value"); }
@Test public void hasSizeOfAtLeastShouldNotThrowExceptionIfMapSizeIsEqualToSuppliedValue() { CheckArg.hasSizeOfAtLeast(Collections.singletonMap("key", "value"), 1, "value"); }
@Test public void hasSizeOfAtLeastShouldNotThrowExceptionIfCollectionSizeIsEqualToSuppliedValue() { CheckArg.hasSizeOfAtLeast(Collections.singletonList(" "), 1, "value"); }
@Test public void hasSizeOfAtLeastShouldNotThrowExceptionIfCollectionSizeIsGreaterThanSuppliedValue() { CheckArg.hasSizeOfAtLeast(Collections.singletonList(" "), 0, "value"); }
@Test( expected = IllegalArgumentException.class ) public void hasSizeOfAtLeastShouldThrowExceptionIfArraySizeIsSmallerThanSuppliedValue() { CheckArg.hasSizeOfAtLeast(new Object[] {"key", "value"}, 3, "value"); }
@Test public void hasSizeOfAtLeastShouldNotThrowExceptionIfArraySizeIsGreaterThanSuppliedValue() { CheckArg.hasSizeOfAtLeast(new Object[] {"key", "value"}, 1, "value"); }
AbstractJcrNode node = (AbstractJcrNode)target; if ("addNode".equals(methodName)) { CheckArg.hasSizeOfAtLeast(arguments, 1, "arguments"); CheckArg.hasSizeOfAtMost(arguments, 2, "arguments"); CheckArg.isInstanceOf(arguments[0], String.class, "arguments[0]");
AbstractJcrNode node = (AbstractJcrNode)target; if ("addNode".equals(methodName)) { CheckArg.hasSizeOfAtLeast(arguments, 1, "arguments"); CheckArg.hasSizeOfAtMost(arguments, 2, "arguments"); CheckArg.isInstanceOf(arguments[0], String.class, "arguments[0]");