Skip to content

Instantly share code, notes, and snippets.

@eliasnogueira
Last active March 25, 2023 14:00
Embed
What would you like to do?
SoftAssertion: AssertJ
import org.assertj.core.api.SoftAssertions;
import org.junit.jupiter.api.Test;
class SoftAssertionTest {
@Test
void softAssertionUsingAssertJ() {
var person = Person.builder().name("John").phoneNumber(null).age(16).build();
SoftAssertions.assertSoftly(softly -> {
softly.assertThat(person.getName()).isNotBlank();
softly.assertThat(person.getPhoneNumber()).isNotNull();
softly.assertThat(person.getAge()).isGreaterThan(18);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment