Feature/string contains in any order
I kindly request to add stringContainsInAnyOrder as a complement to stringContainsInOrder. It matches if all of the substrings are contained within the subject, regardless of the order.
I'm aware that you are able to achieve the same with
assertThat("this is a string", allOf(
contains("string"),
contains("this"),
contains("a")));
But there are cases when you need to work with an unknown list of strings, like String[] or List<String>.
For these cases, it would be nice to have
String[] tokens = classUnderTest.getTokens();
String subject = getTemplate();
assertThat(subject, stringContainsInAnyOrder(tokens))
Just as another workaround for now, if you are on Java8:
assertThat(
subject,
allOf(Stream.of(tokens).map(Matchers::containsString).collect(Collectors.toList()))
);
@tpraxl looks a good idea, happy to look at getting merged if rebased from master as hamcrest-core and hamcrest-library has been merged into hamcrest so can't currently merge in at the moment.
Going to try and kick start hamcrest, so if you want to get it merged, please rebase from the branch v2.3-candidates.
Still trying to understand how has permissions to perform a release.