Skip to content

Instantly share code, notes, and snippets.

@srdo
Created February 9, 2016 12:20
Show Gist options
  • Save srdo/a3584175e47138c87375 to your computer and use it in GitHub Desktop.
Save srdo/a3584175e47138c87375 to your computer and use it in GitHub Desktop.
Set<String> myStrings = new HashSet<>();
myStrings.add("abc");
myStrings.add("def");
Collection<String> otherStrings = new ArrayList<>();
otherStrings.add("def");
assertThat("Expected unequal sets", otherStrings, not(containsInAnyOrder(myStrings)));
otherStrings.add("abc");
assertThat("Expected equal sets", otherStrings, containsInAnyOrder(myStrings));
//Fails on the second assert, prints the missing entry in the assertion error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment