001/*
002 * ModeShape (http://www.modeshape.org)
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *       http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.modeshape.common.util;
017
018import static org.hamcrest.core.Is.is;
019import static org.junit.Assert.assertThat;
020import java.util.Collection;
021import java.util.Collections;
022import java.util.Map;
023import org.junit.Test;
024
025/**
026 *
027 */
028public class ArgCheckTest {
029
030    @Test
031    public void isNonNegativeShouldNotThrowExceptionIfPositiveNumber() {
032        CheckArg.isNonNegative(1, "test");
033    }
034
035    @Test
036    public void isNonNegativeShouldNotThrowExceptionIfZero() {
037        CheckArg.isNonNegative(0, "test");
038    }
039
040    @Test( expected = IllegalArgumentException.class )
041    public void isNonNegativeShouldThrowExceptionIfNegative() {
042        CheckArg.isNonNegative(-1, "test");
043    }
044
045    @Test
046    public void isNonPositiveShouldNotThrowExceptionIfNegativeNumber() {
047        CheckArg.isNonPositive(-1, "test");
048    }
049
050    @Test
051    public void isNonPositiveShouldNotThrowExceptionIfZero() {
052        CheckArg.isNonPositive(0, "test");
053    }
054
055    @Test( expected = IllegalArgumentException.class )
056    public void isNonPositiveShouldThrowExceptionIfPositive() {
057        CheckArg.isNonPositive(1, "test");
058    }
059
060    @Test
061    public void isNegativeShouldNotThrowExceptionIfNegativeNumber() {
062        CheckArg.isNegative(-1, "test");
063    }
064
065    @Test( expected = IllegalArgumentException.class )
066    public void isNegativeShouldThrowExceptionIfZero() {
067        CheckArg.isNegative(0, "test");
068    }
069
070    @Test( expected = IllegalArgumentException.class )
071    public void isNegativeShouldThrowExceptionIfPositive() {
072        CheckArg.isNegative(1, "test");
073    }
074
075    @Test
076    public void isPositiveShouldNotThrowExceptionIfPositiveNumber() {
077        CheckArg.isPositive(1, "test");
078    }
079
080    @Test( expected = IllegalArgumentException.class )
081    public void isPositiveShouldThrowExceptionIfZero() {
082        CheckArg.isPositive(0, "test");
083    }
084
085    @Test( expected = IllegalArgumentException.class )
086    public void isPositiveShouldThrowExceptionIfNegative() {
087        CheckArg.isPositive(-1, "test");
088    }
089
090    @Test
091    public void isNonNegativeLongShouldNotThrowExceptionIfPositiveNumber() {
092        CheckArg.isNonNegative(1l, "test");
093    }
094
095    @Test
096    public void isNonNegativeLongShouldNotThrowExceptionIfZero() {
097        CheckArg.isNonNegative(0l, "test");
098    }
099
100    @Test( expected = IllegalArgumentException.class )
101    public void isNonNegativeLongShouldThrowExceptionIfNegative() {
102        CheckArg.isNonNegative(-1l, "test");
103    }
104
105    @Test
106    public void isNonPositiveLongShouldNotThrowExceptionIfNegativeNumber() {
107        CheckArg.isNonPositive(-1l, "test");
108    }
109
110    @Test
111    public void isNonPositiveLongShouldNotThrowExceptionIfZero() {
112        CheckArg.isNonPositive(0l, "test");
113    }
114
115    @Test( expected = IllegalArgumentException.class )
116    public void isNonPositiveLongShouldThrowExceptionIfPositive() {
117        CheckArg.isNonPositive(1l, "test");
118    }
119
120    @Test
121    public void isNegativeLongShouldNotThrowExceptionIfNegativeNumber() {
122        CheckArg.isNegative(-1l, "test");
123    }
124
125    @Test( expected = IllegalArgumentException.class )
126    public void isNegativeLongShouldThrowExceptionIfZero() {
127        CheckArg.isNegative(0l, "test");
128    }
129
130    @Test( expected = IllegalArgumentException.class )
131    public void isNegativeLongShouldThrowExceptionIfPositive() {
132        CheckArg.isNegative(1l, "test");
133    }
134
135    @Test
136    public void isPositiveLongShouldNotThrowExceptionIfPositiveNumber() {
137        CheckArg.isPositive(1l, "test");
138    }
139
140    @Test( expected = IllegalArgumentException.class )
141    public void isPositiveLongShouldThrowExceptionIfZero() {
142        CheckArg.isPositive(0l, "test");
143    }
144
145    @Test( expected = IllegalArgumentException.class )
146    public void isPositiveLongShouldThrowExceptionIfNegative() {
147        CheckArg.isPositive(-1l, "test");
148    }
149
150    @Test
151    public void isNotEmptyStringShouldNotThrowExceptionIfGivenStringWithAtLeastOneCharacter() {
152        CheckArg.isNotEmpty("a string", "test");
153    }
154
155    @Test( expected = IllegalArgumentException.class )
156    public void isNotEmptyStringShouldThrowExceptionIfGivenNullString() {
157        CheckArg.isNotEmpty((String)null, "test");
158    }
159
160    @Test( expected = IllegalArgumentException.class )
161    public void isNotEmptyStringShouldThrowExceptionIfGivenEmptyString() {
162        CheckArg.isNotEmpty("", "test");
163    }
164
165    @Test( expected = IllegalArgumentException.class )
166    public void isNotEmptyStringShouldThrowExceptionIfGivenStringWithOnlyWhitespace() {
167        CheckArg.isNotEmpty("\t\t  ", "test");
168    }
169
170    @Test
171    public void isNotZeroLengthShouldNotThrowExceptionIfGivenAStringOneCharacterOrLonger() {
172        CheckArg.isNotZeroLength("a", "test");
173    }
174
175    @Test
176    public void isNotZeroLengthShouldNotThrowExceptionIfGivenAStringWithOnlyWhitespace() {
177        CheckArg.isNotZeroLength(" ", "test");
178        CheckArg.isNotZeroLength("\t\t", "test");
179    }
180
181    @Test( expected = IllegalArgumentException.class )
182    public void isNotZeroLengthShouldThrowExceptionIfGivenAStringWithNoCharacters() {
183        CheckArg.isNotZeroLength("", "test");
184    }
185
186    @Test( expected = IllegalArgumentException.class )
187    public void isNotZeroLengthShouldThrowExceptionIfGivenANullString() {
188        CheckArg.isNotZeroLength(null, "test");
189    }
190
191    @Test
192    public void isNotNullShouldNotThrowExceptionIfGivenNonNullReference() {
193        CheckArg.isNotNull("a", "test");
194        CheckArg.isNotNull(new Object(), "test");
195    }
196
197    @Test( expected = IllegalArgumentException.class )
198    public void isNotNullShouldThrowExceptionIfGivenNullReference() {
199        CheckArg.isNotNull(null, "test");
200    }
201
202    @Test
203    public void getNotNullShouldReturnArgument() {
204        assertThat("a", is("a"));
205    }
206
207    @Test( expected = IllegalArgumentException.class )
208    public void getNotNullShouldThrowExceptionIfGivenNullReference() {
209        CheckArg.getNotNull(null, "test");
210    }
211
212    @Test
213    public void isNullShouldNotThrowExceptionIfGivenNullReference() {
214        CheckArg.isNull(null, "test");
215    }
216
217    @Test( expected = IllegalArgumentException.class )
218    public void isNullShouldThrowExceptionIfGivenNonNullReference() {
219        CheckArg.isNull(this, "test");
220    }
221
222    @Test
223    public void isInstanceOfShouldNotThrowExceptionIfReferenceIsInstanceOfTheSuppliedClass() {
224        CheckArg.isInstanceOf(this, this.getClass(), "test");
225    }
226
227    @Test( expected = IllegalArgumentException.class )
228    public void isInstanceOfShouldNotThrowExceptionIfReferenceIsNotInstanceOfTheSuppliedClass() {
229        CheckArg.isInstanceOf(" ", this.getClass(), "test");
230    }
231
232    @Test( expected = IllegalArgumentException.class )
233    public void isInstanceOfShouldNotThrowExceptionIfReferenceIsNull() {
234        CheckArg.isInstanceOf(null, this.getClass(), "test");
235    }
236
237    @Test
238    public void getInstanceOfShouldReturnCastArgument() {
239        Object obj = "a";
240        CheckArg.getInstanceOf(obj, String.class, "test").length();
241    }
242
243    @Test( expected = IllegalArgumentException.class )
244    public void getInstanceOfShouldThrowExceptionIfGivenNullReference() {
245        CheckArg.getInstanceOf(null, getClass(), "test");
246    }
247
248    @Test
249    public void isNotEmptyCollectionShouldNotThrowExceptionIfGivenCollectionWithAtLeastOneObject() {
250        CheckArg.isNotEmpty(Collections.singletonList(" "), "test");
251    }
252
253    @Test( expected = IllegalArgumentException.class )
254    public void isNotEmptyCollectionShouldThrowExceptionIfGivenNullCollection() {
255        CheckArg.isNotEmpty((Collection<?>)null, "test");
256    }
257
258    @Test( expected = IllegalArgumentException.class )
259    public void isNotEmptyCollectionShouldThrowExceptionIfGivenEmptyCollection() {
260        CheckArg.isNotEmpty(Collections.emptyList(), "test");
261    }
262
263    @Test
264    public void isNotEmptyMapShouldNotThrowExceptionIfGivenMapWithAtLeastOneEntry() {
265        CheckArg.isNotEmpty(Collections.singletonMap("key", "value"), "test");
266    }
267
268    @Test( expected = IllegalArgumentException.class )
269    public void isNotEmptyMapShouldThrowExceptionIfGivenNullMap() {
270        CheckArg.isNotEmpty((Map<?, ?>)null, "test");
271    }
272
273    @Test( expected = IllegalArgumentException.class )
274    public void isNotEmptyMapShouldThrowExceptionIfGivenEmptyMap() {
275        CheckArg.isNotEmpty(Collections.emptyMap(), "test");
276    }
277
278    @Test
279    public void isNotEmptyArrayShouldNotThrowExceptionIfGivenArrayWithAtLeastOneEntry() {
280        CheckArg.isNotEmpty(new Object[] {"key", "value"}, "test");
281    }
282
283    @Test
284    public void isNotEmptyArrayShouldNotThrowExceptionIfGivenArrayWithAtNullEntry() {
285        CheckArg.isNotEmpty(new Object[] {"key", "value", null}, "test");
286    }
287
288    @Test( expected = IllegalArgumentException.class )
289    public void isNotEmptyArrayShouldThrowExceptionIfGivenNullArray() {
290        CheckArg.isNotEmpty((Object[])null, "test");
291    }
292
293    @Test( expected = IllegalArgumentException.class )
294    public void isNotEmptyArrayShouldThrowExceptionIfGivenEmptyArray() {
295        CheckArg.isNotEmpty(new Object[] {}, "test");
296    }
297
298    @Test
299    public void isNotSameShouldNotThrowAnExceptionIfPassedSameObject() {
300        CheckArg.isNotSame("a", "first", "b", "second");
301        CheckArg.isNotSame(new String("a"), "first", new String("a"), "second");
302    }
303
304    @Test
305    public void isNotSameShouldNotThrowAnExceptionIfPassedSameObjectWithNoNames() {
306        CheckArg.isNotSame("a", null, "b", null);
307        CheckArg.isNotSame(new String("a"), null, new String("a"), null);
308    }
309
310    @Test
311    public void isNotSameShouldNotThrowAnExceptionIfPassedNullFirstObjectAndNonNullSecondObject() {
312        CheckArg.isNotSame(null, "first", "b", "second");
313    }
314
315    @Test
316    public void isNotSameShouldNotThrowAnExceptionIfPassedNonNullFirstObjectAndNullSecondObject() {
317        CheckArg.isNotSame("a", "first", null, "second");
318    }
319
320    @Test( expected = IllegalArgumentException.class )
321    public void isNotSameShouldThrowAnExceptionIfPassedNullFirstObjectAndNullSecondObject() {
322        CheckArg.isNotSame(null, "first", null, "second");
323    }
324
325    @Test( expected = IllegalArgumentException.class )
326    public void isNotSameShouldThrowAnExceptionIfPassedSameReferenceForFirstSecondObject() {
327        String obj = "something";
328        CheckArg.isNotSame(obj, "first", obj, "second");
329    }
330
331    @Test
332    public void containsShouldNotThrowExceptionIfPassedObjectInCollection() {
333        CheckArg.contains(Collections.singletonList(" "), " ", "test");
334    }
335
336    @Test
337    public void containsShouldNotThrowExceptionIfPassedNullIfCollectionContainsNull() {
338        CheckArg.contains(Collections.singletonList(null), null, "test");
339    }
340
341    @Test( expected = IllegalArgumentException.class )
342    public void containsShouldThrowExceptionIfPassedObjectNotInCollection() {
343        CheckArg.contains(Collections.singletonList(" "), "a", "test");
344    }
345
346    @Test( expected = IllegalArgumentException.class )
347    public void containsShouldThrowExceptionIfPassedNullAndCollectionDoesNotContainNull() {
348        CheckArg.contains(Collections.singletonList(" "), null, "test");
349    }
350
351    @Test
352    public void containsKeyShouldNotThrowExceptionIfPassedObjectInCollection() {
353        CheckArg.containsKey(Collections.singletonMap("key", "value"), "key", "test");
354    }
355
356    @Test
357    public void containsKeyShouldNotThrowExceptionIfPassedNullIfMapContainsNullKey() {
358        CheckArg.containsKey(Collections.singletonMap(null, "value"), null, "test");
359    }
360
361    @Test( expected = IllegalArgumentException.class )
362    public void containsKeyShouldThrowExceptionIfPassedKeyNotInMap() {
363        CheckArg.containsKey(Collections.singletonMap("key", "value"), "a", "test");
364    }
365
366    @Test( expected = IllegalArgumentException.class )
367    public void containsKeyShouldThrowExceptionIfPassedNullAndMapDoesNotContainNullKey() {
368        CheckArg.containsKey(Collections.singletonMap("key", "value"), null, "test");
369    }
370
371    @Test
372    public void containsNoNullsCollectionShouldNotThrowExceptionIfGivenArrayWithAtLeastOneEntry() {
373        CheckArg.containsNoNulls(Collections.singletonList(" "), "test");
374    }
375
376    @Test( expected = IllegalArgumentException.class )
377    public void containsNoNullsCollectionShouldThrowExceptionIfGivenNullCollection() {
378        CheckArg.containsNoNulls((Collection<?>)null, "test");
379    }
380
381    @Test
382    public void containsNoNullsCollectionShouldNotThrowExceptionIfGivenEmptyCollection() {
383        CheckArg.containsNoNulls(Collections.emptyList(), "test");
384    }
385
386    @Test( expected = IllegalArgumentException.class )
387    public void containsNoNullsCollectionShouldThrowExceptionIfGivenCollectionWithNullEntry() {
388        CheckArg.containsNoNulls(Collections.singletonList(null), "test");
389    }
390
391    @Test
392    public void containsNoNullsArrayShouldNotThrowExceptionIfGivenArrayWithAtLeastOneEntry() {
393        CheckArg.containsNoNulls(new Object[] {"key", "value"}, "test");
394    }
395
396    @Test( expected = IllegalArgumentException.class )
397    public void containsNoNullsArrayShouldThrowExceptionIfGivenNullArray() {
398        CheckArg.containsNoNulls((Object[])null, "test");
399    }
400
401    @Test
402    public void containsNoNullsArrayShouldNotThrowExceptionIfGivenEmptyArray() {
403        CheckArg.containsNoNulls(new Object[] {}, "test");
404    }
405
406    @Test( expected = IllegalArgumentException.class )
407    public void containsNoNullsArrayShouldThrowExceptionIfGivenArrayWithNullEntry() {
408        CheckArg.containsNoNulls(new Object[] {"some", null, "thing", null}, "test");
409    }
410
411    @Test( expected = IllegalArgumentException.class )
412    public void isNotLessThanShouldThrowExceptionIfValueIsLessThanSuppliedValue() {
413        CheckArg.isNotLessThan(0, 1, "value");
414    }
415
416    @Test( expected = IllegalArgumentException.class )
417    public void isNotGreaterThanShouldThrowExceptionIfValueIsGreaterThanSuppliedValue() {
418        CheckArg.isNotGreaterThan(1, 0, "value");
419    }
420
421    @Test( expected = IllegalArgumentException.class )
422    public void isNotLessThanShouldThrowExceptionIfValueIsEqualToSuppliedValue() {
423        CheckArg.isNotLessThan(1, 2, "value");
424    }
425
426    @Test( expected = IllegalArgumentException.class )
427    public void isNotGreaterThanShouldThrowExceptionIfValueIsEqualToSuppliedValue() {
428        CheckArg.isNotGreaterThan(2, 1, "value");
429    }
430
431    @Test( expected = IllegalArgumentException.class )
432    public void isLessThanShouldThrowExceptionIfValueIsGreaterThanSuppliedValue() {
433        CheckArg.isLessThan(1, 0, "value");
434    }
435
436    @Test( expected = IllegalArgumentException.class )
437    public void isGreaterThanShouldThrowExceptionIfValueIsLessThanSuppliedValue() {
438        CheckArg.isGreaterThan(0, 1, "value");
439    }
440
441    @Test( expected = IllegalArgumentException.class )
442    public void isLessThanShouldThrowExceptionIfValueIsEqualToSuppliedValue() {
443        CheckArg.isLessThan(1, 1, "value");
444    }
445
446    @Test( expected = IllegalArgumentException.class )
447    public void isGreaterThanShouldThrowExceptionIfValueIsEqualToSuppliedValue() {
448        CheckArg.isGreaterThan(1, 1, "value");
449    }
450
451    @Test( expected = IllegalArgumentException.class )
452    public void isLessThanOrEqualToShouldThrowExceptionIfValueIsNotLessThanOrEqualToSuppliedValue() {
453        CheckArg.isLessThanOrEqualTo(1, 0, "value");
454    }
455
456    @Test( expected = IllegalArgumentException.class )
457    public void isGreaterThanOrEqualToShouldThrowExceptionIfValueIsNotGreaterThanOrEqualToSuppliedValue() {
458        CheckArg.isGreaterThanOrEqualTo(0, 1, "value");
459    }
460
461    @Test
462    public void isNotLessThanShouldNotThrowExceptionIfValueIsNotLessThanSuppliedValue() {
463        CheckArg.isNotLessThan(1, 1, "value");
464        CheckArg.isNotLessThan(2, 1, "value");
465        CheckArg.isNotLessThan(100, 1, "value");
466    }
467
468    @Test
469    public void isNotGreaterThanShouldNotThrowExceptionIfValueIsNotGreaterThanSuppliedValue() {
470        CheckArg.isNotGreaterThan(1, 1, "value");
471        CheckArg.isNotGreaterThan(1, 2, "value");
472        CheckArg.isNotGreaterThan(1, 100, "value");
473    }
474
475    @Test
476    public void isLessThanShouldNotThrowExceptionIfValueIsLessThanSuppliedValue() {
477        CheckArg.isLessThanOrEqualTo(1, 2, "value");
478        CheckArg.isLessThanOrEqualTo(1, 100, "value");
479    }
480
481    @Test
482    public void isGreaterThanShouldNotThrowExceptionIfValueIsGreaterThanSuppliedValue() {
483        CheckArg.isGreaterThan(2, 1, "value");
484        CheckArg.isGreaterThan(100, 1, "value");
485    }
486
487    @Test
488    public void isLessThanOrEqualToShouldNotThrowExceptionIfValueIsLessThanOrEqualToSuppliedValue() {
489        CheckArg.isLessThanOrEqualTo(1, 1, "value");
490        CheckArg.isLessThanOrEqualTo(1, 2, "value");
491        CheckArg.isLessThanOrEqualTo(1, 100, "value");
492    }
493
494    @Test
495    public void isGreaterThanOrEqualToShouldNotThrowExceptionIfValueIsGreaterThanOrEqualToSuppliedValue() {
496        CheckArg.isGreaterThanOrEqualTo(1, 1, "value");
497        CheckArg.isGreaterThanOrEqualTo(2, 1, "value");
498        CheckArg.isGreaterThanOrEqualTo(100, 1, "value");
499    }
500
501    @Test( expected = IllegalArgumentException.class )
502    public void hasSizeOfAtLeastShouldThrowExceptionIfCollectionSizeIsSmallerThanSuppliedValue() {
503        CheckArg.hasSizeOfAtLeast(Collections.singletonList(" "), 2, "value");
504    }
505
506    @Test( expected = IllegalArgumentException.class )
507    public void hasSizeOfAtMostShouldThrowExceptionIfCollectionSizeIsLargerThanSuppliedValue() {
508        CheckArg.hasSizeOfAtMost(Collections.singletonList(" "), 0, "value");
509    }
510
511    @Test
512    public void hasSizeOfAtLeastShouldNotThrowExceptionIfCollectionSizeIsEqualToSuppliedValue() {
513        CheckArg.hasSizeOfAtLeast(Collections.singletonList(" "), 1, "value");
514    }
515
516    @Test
517    public void hasSizeOfAtMostShouldNotThrowExceptionIfCollectionSizeIsEqualToSuppliedValue() {
518        CheckArg.hasSizeOfAtMost(Collections.singletonList(" "), 1, "value");
519    }
520
521    @Test
522    public void hasSizeOfAtLeastShouldNotThrowExceptionIfCollectionSizeIsGreaterThanSuppliedValue() {
523        CheckArg.hasSizeOfAtLeast(Collections.singletonList(" "), 0, "value");
524    }
525
526    @Test
527    public void hasSizeOfAtMostShouldNotThrowExceptionIfCollectionSizeIsGreaterThanSuppliedValue() {
528        CheckArg.hasSizeOfAtMost(Collections.singletonList(" "), 2, "value");
529    }
530
531    @Test( expected = IllegalArgumentException.class )
532    public void hasSizeOfAtLeastShouldThrowExceptionIfMapSizeIsSmallerThanSuppliedValue() {
533        CheckArg.hasSizeOfAtLeast(Collections.singletonMap("key", "value"), 2, "value");
534    }
535
536    @Test( expected = IllegalArgumentException.class )
537    public void hasSizeOfAtMostShouldThrowExceptionIfMapSizeIsLargerThanSuppliedValue() {
538        CheckArg.hasSizeOfAtMost(Collections.singletonMap("key", "value"), 0, "value");
539    }
540
541    @Test
542    public void hasSizeOfAtLeastShouldNotThrowExceptionIfMapSizeIsEqualToSuppliedValue() {
543        CheckArg.hasSizeOfAtLeast(Collections.singletonMap("key", "value"), 1, "value");
544    }
545
546    @Test
547    public void hasSizeOfAtMostShouldNotThrowExceptionIfMapSizeIsEqualToSuppliedValue() {
548        CheckArg.hasSizeOfAtMost(Collections.singletonMap("key", "value"), 1, "value");
549    }
550
551    @Test
552    public void hasSizeOfAtLeastShouldNotThrowExceptionIfMapSizeIsGreaterThanSuppliedValue() {
553        CheckArg.hasSizeOfAtLeast(Collections.singletonMap("key", "value"), 0, "value");
554    }
555
556    @Test
557    public void hasSizeOfAtMostShouldNotThrowExceptionIfMapSizeIsGreaterThanSuppliedValue() {
558        CheckArg.hasSizeOfAtMost(Collections.singletonMap("key", "value"), 2, "value");
559    }
560
561    @Test( expected = IllegalArgumentException.class )
562    public void hasSizeOfAtLeastShouldThrowExceptionIfArraySizeIsSmallerThanSuppliedValue() {
563        CheckArg.hasSizeOfAtLeast(new Object[] {"key", "value"}, 3, "value");
564    }
565
566    @Test( expected = IllegalArgumentException.class )
567    public void hasSizeOfAtMostShouldThrowExceptionIfArraySizeIsLargerThanSuppliedValue() {
568        CheckArg.hasSizeOfAtMost(new Object[] {"key", "value"}, 1, "value");
569    }
570
571    @Test
572    public void hasSizeOfAtLeastShouldNotThrowExceptionIfArraySizeIsEqualToSuppliedValue() {
573        CheckArg.hasSizeOfAtLeast(new Object[] {"key", "value"}, 2, "value");
574    }
575
576    @Test
577    public void hasSizeOfAtMostShouldNotThrowExceptionIfArraySizeIsEqualToSuppliedValue() {
578        CheckArg.hasSizeOfAtMost(new Object[] {"key", "value"}, 2, "value");
579    }
580
581    @Test
582    public void hasSizeOfAtLeastShouldNotThrowExceptionIfArraySizeIsGreaterThanSuppliedValue() {
583        CheckArg.hasSizeOfAtLeast(new Object[] {"key", "value"}, 1, "value");
584    }
585
586    @Test
587    public void hasSizeOfAtMostShouldNotThrowExceptionIfArraySizeIsGreaterThanSuppliedValue() {
588        CheckArg.hasSizeOfAtMost(new Object[] {"key", "value"}, 3, "value");
589    }
590
591}