import static org.junit.matchers.JUnitMatchers.both;
import static org.junit.matchers.JUnitMatchers.containsString;
Now I check it contains foo and bar as below ...
Assert.assertThat(text,
both(containsString("foo")).
and(containsString("bar")));
What is cleanest way to test that it contains 3 or more strings e.g. 'foo', 'bar' and 'baz' ?
assertThat(text).contains("foo", "bar", "baz");
- it's even more succinct. – Pacificism