jocarreira / hamcrest

Automatically exported from code.google.com/p/hamcrest
0 stars 0 forks source link

Create NonEmptyXXX matchers #121

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
This is equivalent to allOf(arrayValue(), not(emptyArray())) but more 
expressive.

This is different from simply not(emptyArray()) which will pass for the string 
"bob" but should not.

- Array
- String
- Traversable, Iterable
- Collections in general, anything that can be tested for emptiness

Original issue reported on code.google.com by dharkn...@gmail.com on 18 Aug 2010 at 11:39

GoogleCodeExporter commented 8 years ago
Actually, this is equivalent to arrayWithSize(not(0)) so a static factory could 
work.

    public static function nonEmptyArray() {
        return self::arrayWithSize(Hamcrest_Core_Not(0));
    }

Original comment by dharkn...@gmail.com on 19 Aug 2010 at 12:31

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Complete in 1.1 for array, string, and traversable.

Original comment by dharkn...@gmail.com on 2 Feb 2012 at 11:52