By
using ‘emptyIterableOf’ method, you can create a matcher for Iterables matching
examined iterables that yield no items.
Ex
List<Integer>
tempList = Arrays.asList();
assertThat("empty
must be empty", tempList, emptyIterableOf(Integer.class));
Find
the below working application.
TestApp.java
package com.sample.tests; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.emptyIterableOf; import java.util.Arrays; import java.util.List; import org.junit.Test; public class TestApp { @Test public void testmethod() { List<Integer> tempList = Arrays.asList(); assertThat("empty must be empty", tempList, emptyIterableOf(Integer.class)); } }
No comments:
Post a Comment