void (String methodName, String id, String parentId, String messageName, Throwable ex, long duration, String reason, boolean includeThrowable) { Map<String, String> attrs = new LinkedHashMap<>(); attrs.put("name", methodName); attrs.put("id", id); attrs.put("nodeId", id); attrs.put("parentNodeId", parentId); if (duration > 0) { attrs.put("duration", Long.toString(duration)); } if (reason != null) { attrs.put("message", reason); } try { if (ex != null) { ComparisonFailureData failureData = null; if (ex instanceof MultipleFailuresError && ((MultipleFailuresError)ex).hasFailures()) { for (Throwable assertionError : ((MultipleFailuresError)ex).getFailures()) { testFailure(methodName, id, parentId, messageName, assertionError, duration, reason, true); } } else if (ex instanceof AssertionFailedError && !(ex instanceof FileComparisonData) && ((AssertionFailedError)ex).isActualDefined() && ((AssertionFailedError)ex).isExpectedDefined()) { ValueWrapper actual = ((AssertionFailedError)ex).getActual(); ValueWrapper expected = ((AssertionFailedError)ex).getExpected(); failureData = new ComparisonFailureData(expected.getStringRepresentation(), actual.getStringRepresentation()); } else { //try to detect failure with junit 4 if present in the classpath try { failureData = ExpectedPatterns.createExceptionNotification(ex); } catch (Throwable ignore) {} } if (includeThrowable || failureData == null) { ComparisonFailureData.registerSMAttributes(failureData, getTrace(ex), ex.getMessage(), attrs, ex, "Comparison Failure: ", "expected: <"); } else { ComparisonFailureData.registerSMAttributes(failureData, "", ex.getMessage(), attrs, ex, "Comparison Failure: ", "expected: <"); } } } finally { myPrintStream.println(MapSerializerUtil.asString(messageName, attrs)); } }