@Test public void formatsExpectationReport() { ReportEvent expected = anEvent("expected invocation"); ReportEvent actual = anEvent("actual invocation"); List<ReportEvent> history = aHistory("event 1", "event 2", "event 3"); List<ReportEvent> unmetHistory = aHistory("event 4", "event 5", "event 6"); FormattedReport report = new FormattedReport( expected, actual, history, unmetHistory ); String expectedReport = "" + "Expected: expected invocation\n" + "Actual: actual invocation\n" + "What happened before:\n" + " event 1\n" + " event 2\n" + " event 3\n" + "Unmet Expectations:\n" + " event 4\n" + " event 5\n" + " event 6\n"; Assert.assertEquals(expectedReport, report.format()); }
public String format() { return "Expected: " + expected.toString() + "\n" + "Actual: " + actual.toString() + "\n" + "What happened before:\n" + formatEventList(history) + "\n" + "Unmet Expectations:\n" + formatEventList(unmetHistory) + "\n"; }
FormattedReport { public String format() { return "Expected: " + expected.toString() + "\n" + "Actual: " + actual.toString() + "\n" + "What happened before:\n" + formatEventList(history) + "\n" + "Unmet Expectations:\n" + formatEventList(unmetHistory) + "\n"; } }
FormattedReport { public String format() { return "Expected: " + expected.toString() + "\n" + "Actual: " + actual.toString() + "\n" + "What happened before:\n" + formatEventList(history) + "\n" + "Unmet Expectations:\n" + formatEventList(unmetHistory) + "\n"; } FormattedReport(
            ReportEvent expected,
            ReportEvent actual,
            List<ReportEvent> history,
            List<ReportEvent> unmetHistory
    ); }
FormattedReport { public String format() { return "Expected: " + expected.toString() + "\n" + "Actual: " + actual.toString() + "\n" + "What happened before:\n" + formatEventList(history) + "\n" + "Unmet Expectations:\n" + formatEventList(unmetHistory) + "\n"; } FormattedReport(
            ReportEvent expected,
            ReportEvent actual,
            List<ReportEvent> history,
            List<ReportEvent> unmetHistory
    ); String format(); }
FormattedReport { public String format() { return "Expected: " + expected.toString() + "\n" + "Actual: " + actual.toString() + "\n" + "What happened before:\n" + formatEventList(history) + "\n" + "Unmet Expectations:\n" + formatEventList(unmetHistory) + "\n"; } FormattedReport(
            ReportEvent expected,
            ReportEvent actual,
            List<ReportEvent> history,
            List<ReportEvent> unmetHistory
    ); String format();  }