@Test public void testShouldDoNothingIfThereIsNoEncapsulatedFixturePresent() throws Exception { String fitPage = "<table>" + geDecoratorHTMLRow() + "</table>"; Dispatcher dispatcher = new Dispatcher(); dispatcher.doTables(new Parse(fitPage)); assertNull(dispatcher.summary.get(FixtureDecorator.ENCAPSULATED_FIXTURE_NAME)); TestCaseHelper.assertCounts(TestCaseHelper.counts(0, 0, 0, 0), dispatcher.counts); }
@Test public void testShouldHandleInvalidInputExceptionIfThrownBySetUpMethod() throws Exception { String fitPage = "<table>" + geWrongDecoratorHTMLRow() + "<tr><td>" + TestFixture.class.getName() + "</td></tr></table>"; Dispatcher dispatcher = new Dispatcher(); dispatcher.doTables(new Parse(fitPage)); TestCaseHelper.assertCounts(TestCaseHelper.counts(0, 0, 0, 1), dispatcher.counts); }
@Test public void testShouldBeAbleToExecuteEncapsulatedFixture() throws ParseException { String fitPage = "<table>" + geDecoratorHTMLRow() + "<tr><td>eg.Division</td></tr>" + "<tr><td>numerator</td><td>denominator</td><td>quotient()</td></tr>" + "<tr><td>100</td><td>4</td><td>25</td></tr></table>"; Dispatcher dispatcher = new Dispatcher(); dispatcher.doTables(new Parse(fitPage)); int right = 1 + numberOfAssertionsOnDecorator(); TestCaseHelper.assertCounts(TestCaseHelper.counts(right, 0, 0, 0), dispatcher.counts); }
protected void executeAndAssert(Counts expected, String fitPage, Fixture fixture) throws ParseException { fixture.doTable(new Parse(fitPage)); TestCaseHelper.assertCounts(expected, fixture.counts); }