Is there a nicer way to write in jUnit
String x = "foo bar";
Assert.assertTrue(x.contains("foo"));
Is there a nicer way to write in jUnit
String x = "foo bar";
Assert.assertTrue(x.contains("foo"));
If you add in Hamcrest and JUnit4, you could do:
String x = "foo bar";
Assert.assertThat(x, Matchers.containsString("foo"));
With some static imports, it looks a lot better:
assertThat(x, containsString("foo"));