Merge pull request #4201 from eugenp/hamcrest-iterable

emptyiterable ex
This commit is contained in:
Loredana Crusoveanu 2018-05-09 23:24:42 +03:00 committed by GitHub
commit 21f0bdf180
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -12,6 +12,7 @@ import static org.hamcrest.Matchers.hasItems;
import static org.hamcrest.Matchers.hasSize;
import static org.hamcrest.Matchers.not;
import static org.junit.Assert.assertThat;
import static org.hamcrest.Matchers.emptyIterable;
import java.util.Collections;
import java.util.List;
@ -57,6 +58,12 @@ public class HamcrestExamplesUnitTest {
final List<String> collection = Lists.newArrayList();
assertThat(collection, empty());
}
@Test
public final void givenIterableIsEmpty_whenChecking_thenEmpty() {
final Iterable<String> collection = Lists.newArrayList();
assertThat(collection, emptyIterable());
}
@Test
public final void givenCollectionIsNotEmpty_whenChecking_thenNotEmpty() {