ComparisonFailureData (Throwable assertion) { try { Class assertionClass = assertion.getClass(); if (assertionClass.getName().equals(OPENTEST4J_ASSERTION)) { Class[] parameterTypes = new Class[0]; Object[] args = new Object[0]; if (((Boolean)assertionClass.getDeclaredMethod("isExpectedDefined", parameterTypes).invoke(assertion, args)).booleanValue() && ((Boolean)assertionClass.getDeclaredMethod("isActualDefined", parameterTypes).invoke(assertion, args)).booleanValue()) { Object expected = assertionClass.getDeclaredMethod("getExpected", parameterTypes).invoke(assertion, args); Object expectedString = expected.getClass().getDeclaredMethod("getStringRepresentation", parameterTypes).invoke(expected, args); Object actual = assertionClass.getDeclaredMethod("getActual", parameterTypes).invoke(assertion, args); Object actualString = actual.getClass().getDeclaredMethod("getStringRepresentation", parameterTypes).invoke(actual, args); return new ComparisonFailureData((String)expectedString, (String)actualString); } } } catch (Throwable e) { return null; } return null; }