@Test public void shouldReportMissingRows() { reportingSystem = new FitFixtureReportingSystem(new Fixture(), table); reportingSystem.addCell(createCellResult("*S-1*", null, SUCCESS)); reportingSystem.addCell(createCellResult("*S-2*", null, SUCCESS)); reportingSystem.endRow(createNullRowResult(SUCCESS)); reportingSystem.addCell(createCellResult("*M-1*", null, MISSING)); reportingSystem.addCell(createCellResult("*M-2*", null, MISSING)); reportingSystem.endRow(createNullRowResult(MISSING)); assertThat(table, numRowsWithDescription(1, "missing", "fail")); }
@Test public void shouldReportSurplusRows() { reportingSystem = new FitFixtureReportingSystem(new Fixture(), table); reportingSystem.addCell(createCellResult("*M-1*", null, MISSING)); reportingSystem.endRow(createNullRowResult(MISSING)); reportingSystem.addCell(createCellResult(null, "*S-1*", SURPLUS)); reportingSystem.endRow(createNullRowResult(SURPLUS)); assertThat( table, numPartsThat( 1, allOf( hasTagThat(allOf(containsString("<tr"), containsString("fail"))), hasDescriptionThat(containsString("surplus")), numPartsThat( 1, allOf( hasTagThat(allOf(containsString("<td"), containsString("fail"))), hasBodyThat(containsString("*S-1*"))))))); }
@Test public void shouldReportExceptionCells() { reportingSystem = new FitFixtureReportingSystem(new Fixture(), table); reportingSystem.addCell(createCellException("*E-1*", "*E-1*", new Exception("Cruel World!"))); reportingSystem.endRow(createNullRowResult(EXCEPTION)); assertThat(table, numCellsWith(1, "*E-1*", "error")); assertThat( table, isParseThat() .withRecursiveChildren() .withRecursiveSiblings() .which( allOf( hasTagThat(containsString("<td")), hasBodyThat(containsString("Cruel World!")), hasBodyThat(containsString("stacktrace"))))); }