@Test public void formatsEmptyHistoryAsNothing() { ReportEvent expected = anEvent("expected invocation"); ReportEvent actual = anEvent("actual invocation"); List<ReportEvent> emptyHistory = aHistory(); List<ReportEvent> emptyUnmetHistory = aHistory(); FormattedReport report = new FormattedReport( expected, actual, emptyHistory, emptyUnmetHistory ); String expectedReport = "" + "Expected: expected invocation\n" + "Actual: actual invocation\n" + "What happened before:\n" + " Nothing!\n" + "Unmet Expectations:\n" + " Nothing!\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();  }