### Question:
SeLionSoftAssert extends Assertion { public void assertAll() { if (allErrors.isEmpty()) { return; } StringBuilder sb = new StringBuilder(); if (1 == allErrors.size()) { sb.append("A soft assertion failure occurred [\n"); } else { sb.append("Multiple (").append(allErrors.size()).append(") soft assertion failures occurred [\n"); } int counter = 0; AssertionError eachError; for (Entry<AssertionError, IAssert<?>> eachEntry : allErrors.entrySet()) { eachError = eachEntry.getKey(); sb.append("\t") .append(counter += 1) .append(". ") .append(ExceptionUtils.getRootCauseMessage(eachError)) .append("\n"); if (Reporter.getCurrentTestResult() != null) { sb.append(StringUtils.substringBetween(ExceptionUtils.getStackTrace(eachError), "\n", "\tat sun.reflect").replace("\t", "\t\t")); } else { sb.append(StringUtils.substringAfter(ExceptionUtils.getStackTrace(eachError),"\n").replace("\t", "\t\t")); } } sb.append("\t]"); if (Reporter.getCurrentTestResult() != null) { Reporter.getCurrentTestResult().setThrowable(new AssertionError(sb.toString())); Reporter.getCurrentTestResult().setStatus(ITestResult.FAILURE); } else { throw new AssertionError(sb.toString()); } }  @Override void onAssertSuccess(IAssert<?> assertCommand); @Override void onAssertFailure(IAssert<?> assertCommand, AssertionError ex); @Override void executeAssert(IAssert<?> a); void assertAll(); static final String SOFT_ASSERT_ATTRIBUTE_NAME; }### Answer:
@Test(groups = { "unit" }) public void softAssertTest1() { SeLionSoftAssert softAssert = new SeLionSoftAssert(); softAssert.assertEquals("OK", "OK", "soft Assert 1"); softAssert.assertTrue(true, "soft Assert 2"); softAssert.assertAll(); }
@Test(groups = { "unit" }) public void softAssertTest2() { SeLionSoftAssert softAssert = new SeLionSoftAssert(); softAssert.assertNotEquals("OK", "NOTOK", "soft Assert 3"); softAssert.assertFalse(false, "soft Assert 4"); softAssert.assertAll(); }
@Test(groups = { "unit" }, expectedExceptions = { AssertionError.class }) public void softAssertFailTest() { SeLionSoftAssert softAssert = new SeLionSoftAssert(); softAssert.assertNotEquals("OK", "NOTOK", "soft Assert 3"); softAssert.assertFalse(true, "soft Assert 4"); softAssert.assertEquals(true, true, "soft Assert 5"); softAssert.assertAll(); }