I am using the below code to assert text in my test script. But its giving UnsupportedOperationException error every time it hits this code.
public static void verifyEquals(Object actual, Object expected) {
try {
Assert.assertEquals(actual, expected);
} catch(Throwable e) {
addVerificationFailure(e);
}
}
public static List<Throwable> getVerificationFailures() {
List verificationFailures = verificationFailuresMap.get(Reporter.getCurrentTestResult());
return verificationFailures == null ? new ArrayList() : verificationFailures;
}
private static void addVerificationFailure(Throwable e) {
StackTraceElement[] error = e.getStackTrace();
List<StackTraceElement> errors = Arrays.asList(error);
verificationFailuresMap.put(Reporter.getCurrentTestResult(), errors);
List verificationFailures = getVerificationFailures();
verificationFailuresMap.put(Reporter.getCurrentTestResult(), verificationFailures);
verificationFailures.add(e);
}
Can anyone help me on this?