By
using ‘emptyIterable’ 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, emptyIterable());
Find
the below working application.
TestApp.java
package com.sample.tests; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.emptyIterable; 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, emptyIterable()); } }
No comments:
Post a Comment