I would like to test that a particular method can handle a bunch of strings without an exception. Therefore, I would like to use AssertJ's soft assertions, something like:
SoftAssertion softly = new SoftAssertion();
for (String s : strings) {
Foo foo = new Foo();
try {
foo.bar(s);
// Mark soft assertion passed.
} catch (IOException e) {
// Mark soft assertion failed.
}
}
softly.assertAll();
Unfortunately, I have to stick to AssertJ 1.x respectively Java 6, so I cannot take advantage of this:
assertThatCode(() -> {
// code that should throw an exception
...
}).doesNotThrowAnyException();
Is there a way do this with AssertJ (or JUnit)?