org.hamcrest.collection.IsEmptyIterable Java Examples
The following examples show how to use
org.hamcrest.collection.IsEmptyIterable.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AppTest.java From jpeek with MIT License | 6 votes |
@Test @SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops") public void isXsdDocumented() throws IOException { final List<XML> elements = new XMLDocument( AppTest.class.getResourceAsStream("xsd/metric.xsd") ).nodes("//node()[@name]"); final IsNot<? super List<?>> populated = new IsNot<>( new IsEmptyIterable<>() ); new Assertion<>( "Nodes must not be empty", elements, populated ).affirm(); for (final XML element : elements) { new Assertion<>( String.format( "element '%s' must have a documentation", element.xpath("@name").get(0) ), element.xpath("xs:annotation/xs:documentation/text()"), populated ).affirm(); } }
Example #2
Source File: CollectionOfTest.java From cactoos with MIT License | 5 votes |
@Test() public void returnsIteratorWithSupportedRemove() { final CollectionEnvelope<String> list = new CollectionEnvelope<String>( new CollectionOf<>("eleven") ) { }; final Iterator<String> iterator = list.iterator(); iterator.next(); iterator.remove(); new Assertion<>( "Must return an empty Iterator", new IterableOf<>(iterator), new IsEmptyIterable<>() ).affirm(); }
Example #3
Source File: StickyTest.java From cactoos with MIT License | 5 votes |
@Test public void testEmpty() { new Assertion<>( "Must be empty", new Sticky<>(), new IsEmptyIterable<>() ).affirm(); }
Example #4
Source File: FilteredTest.java From cactoos with MIT License | 5 votes |
@Test public void filterEmptyList() { new Assertion<>( "Filter must work on empty collection", new Filtered<String>( input -> input.length() > 4, new ListOf<>() ), new IsEmptyIterable<>() ).affirm(); }
Example #5
Source File: FilteredTest.java From cactoos with MIT License | 5 votes |
@Test public void withItemsNotEmpty() { new Assertion<>( "Must not be empty with items", new Filtered<String>( input -> input.length() > 4, new IterableOf<>("first", "second") ), new IsNot<>(new IsEmptyIterable<>()) ).affirm(); }
Example #6
Source File: FilteredTest.java From cactoos with MIT License | 5 votes |
@Test public void withoutItemsIsEmpty() { new Assertion<>( "Must be empty without items", new Filtered<String>( input -> input.length() > 16, new IterableOf<>("third", "fourth") ), new IsEmptyIterable<>() ).affirm(); }
Example #7
Source File: SkippedTest.java From cactoos with MIT License | 5 votes |
@Test public void skippedAllElements() { new Assertion<>( "Must skip all elements", new Skipped<>( 2, "Frodo", "Gandalf" ), new IsEmptyIterable<>() ).affirm(); }
Example #8
Source File: SkippedTest.java From cactoos with MIT License | 5 votes |
@Test public void skippedMoreThanExists() { new Assertion<>( "Can't skip more than exists", new Skipped<>( Integer.MAX_VALUE, "Sauron", "Morgoth" ), new IsEmptyIterable<>() ).affirm(); }
Example #9
Source File: ReversedTest.java From cactoos with MIT License | 5 votes |
@Test public void reverseEmptyList() { new Assertion<>( "Must reverse empty list", new Reversed<>( new ListOf<>() ), new IsEmptyIterable<>() ).affirm(); }
Example #10
Source File: ReversedTest.java From cactoos with MIT License | 5 votes |
@Test public void isEmpty() { new Assertion<>( "Must be not empty", new Reversed<>( new IterableOf<>( 6, 16 ) ), new IsNot<>(new IsEmptyIterable<>()) ).affirm(); }
Example #11
Source File: XmlParserTests.java From java-mammoth with BSD 2-Clause "Simplified" License | 5 votes |
private Matcher<Iterable<XmlNode>> isNodes(List<Matcher<? extends XmlNode>> children) { if (children.isEmpty()) { return (Matcher)new IsEmptyIterable<>(); } else { return new IsIterableContainingInOrder<>((List) children); } }