Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SoftAssertions: TestNG
public class SoftAssertTestNGTest {
@Test
public void testNGSoftAssertion() {
var person = Person.builder().name("John").phoneNumber(null).age(16).build();
SoftAssert softAssert = new SoftAssert();
softAssert.assertEquals(person.getName(), "John");
softAssert.assertNotNull(person.getPhoneNumber(), "Phone number cannot be null");
softAssert.assertEquals(person.getAge(), 25, "Age should be equal");
softAssert.assertAll();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment