ComparisonFailureData (Throwable assertion) { if (assertion instanceof FileComparisonData) { final FileComparisonData comparisonFailure = (FileComparisonData)assertion; String actual = comparisonFailure.getActualStringPresentation(); String expected = comparisonFailure.getExpectedStringPresentation(); if (actual != null && expected != null) { return new ComparisonFailureData(expected, actual, comparisonFailure.getFilePath(), comparisonFailure.getActualFilePath()); } } if (assertion instanceof FileComparisonFailure) { final FileComparisonFailure comparisonFailure = (FileComparisonFailure)assertion; String actual = comparisonFailure.getActual(); String expected = comparisonFailure.getExpected(); if (actual != null && expected != null) { return new ComparisonFailureData(expected, actual, comparisonFailure.getFilePath(), comparisonFailure.getActualFilePath()); } } ComparisonFailureData commonAssertion = createCommonAssertion(assertion); if (commonAssertion != null) return commonAssertion; try { return new ComparisonFailureData(getExpected(assertion), getActual(assertion)); } catch (IllegalAccessException | NoSuchFieldException e) { return null; } }