@Override public void testAssertionVerified(Assertion assertion, TestResult testResult) { if (testResult != null && testResult.doesCount() && (testResult.getExecutionResult() == ExecutionResult.FAIL || testResult.getExecutionResult() == ExecutionResult.ERROR)) { firstFailure(testResult.getExecutionResult(), createMessage(testResult)); } }
public boolean matches() { TestResult testResult = evaluate(); return testResult != null && testResult.getExecutionResult() == ExecutionResult.PASS; }
String createMessage(TestResult testResult) { if (testResult.hasActual() && testResult.hasExpected()) { return String.format("[%s] expected [%s]", testResult.getActual(), testResult.getExpected()); } else if ((testResult.hasActual() || testResult.hasExpected()) && testResult.hasMessage()) { return String.format( "[%s] %s", testResult.hasActual() ? testResult.getActual() : testResult.getExpected(), testResult.getMessage()); } return testResult.getMessage(); }