Created
February 8, 2016 10:43
-
-
Save dedeibel/1284459e46f23e85b5ee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static java.util.Arrays.asList; | |
import static org.hamcrest.MatcherAssert.assertThat; | |
import org.junit.Test; | |
import com.google.common.collect.ImmutableList; | |
public class MyMatchersTest { | |
@Test | |
public void testSameAsSet() throws Exception { | |
assertThat(asList("a", "b", "c"), sameAsSet(asList("a", "b", "c"))); | |
assertThat(asList("c", "b", "a"), sameAsSet(asList("a", "b", "c"))); | |
assertThat(asList("b", "c", "a"), sameAsSet(asList("a", "b", "c"))); | |
assertThat(ImmutableList.of("b", "c", "a"), sameAsSet(asList("a", "b", "c"))); | |
assertThat(asList("b", "c", "a"), sameAsSet(ImmutableList.of("a", "b", "c"))); | |
} | |
@Test(expected = AssertionError.class) | |
public void testSameAsSetFailMoreExpected() throws Exception { | |
assertThat(asList("a", "b", "c"), sameAsSet(asList("a", "b", "c", "d"))); | |
} | |
@Test(expected = AssertionError.class) | |
public void testSameAsSetFailLessExpected() throws Exception { | |
assertThat(asList("a", "b", "c"), sameAsSet(asList("a", "b"))); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment