import static org.junit.matchers.JUnitMatchers.both;
import static org.junit.matchers.JUnitMatchers.containsString;
Run Code Online (Sandbox Code Playgroud)
现在我检查它包含foo和bar如下...
Assert.assertThat(text,
both(containsString("foo")).
and(containsString("bar")));
Run Code Online (Sandbox Code Playgroud)
什么是最干净的测试方法还检查它包含3个或更多字符串,例如'foo','bar'和'baz'?