Skip to content

Instantly share code, notes, and snippets.

@toto-castaldi
Last active September 25, 2017 13:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save toto-castaldi/42c890460701294e363c to your computer and use it in GitHub Desktop.
Save toto-castaldi/42c890460701294e363c to your computer and use it in GitHub Desktop.
//junit<->junit<->4.12
//org.hamcrest<->hamcrest-all<->1.3
import static org.junit.internal.matchers.StringContains.*;
import static org.junit.Assert.*;
assertThat("ABC", containsString("B"));
import static org.junit.internal.matchers.IsCollectionContaining.*;
import static org.hamcrest.core.IsEqual.*;
import static org.junit.Assert.*;
Iterable<String> strings;
assertThat(strings, hasItem(equalTo("A")));
import static org.hamcrest.core.IsEqual.equalTo;
import static org.hamcrest.core.IsNot.*;
import static org.junit.Assert.assertThat;
assertThat("A", not(equalTo("B")));
import static org.hamcrest.Matchers.greaterThan;
assertThat(2, greaterThan(1));
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
assertThat(collection, hasSize(5));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment