I have:
@Test
public void testSomethingInFooFunction() {
//given
Something parameter = new Something();
//when
List<Object> result = foo(parameter);
//then
// not working
assertThat(result).isEmpty().or().contains(something());
assertThat(result).or(v -> v.isEmpty() || v.contains(something());
//is working
assertThat(modifiedPDs.isEmpty() || (
modifiedPDs.contains(something())
&& modifiedPDs.size() == 1)
).isTrue();
}
Is there any other way to test condition like:
result.isEmpty() || ( result.contains(something()) && result.size() == 1)
Q: How to simplify it with AssertJ 3.11.1 ?
Aucun commentaire:
Enregistrer un commentaire