@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 testShouldBeAbleToFindEncapsulatedFixtureName() throws Exception {
   String fitPage = "<table>" + geDecoratorHTMLRow() + "<tr><td>eg.Division</td></tr></table>";
   Dispatcher dispatcher = new Dispatcher();
   dispatcher.doTables(new Parse(fitPage));
   String encapsulatedFixtureName =
       (String) dispatcher.summary.get(FixtureDecorator.ENCAPSULATED_FIXTURE_NAME);
   assertEquals("eg.Division", encapsulatedFixtureName);
 }
 @Test
 public void testShouldMarkExceptionIfEncapsulatingFixtureNameIsInvalid() throws Exception {
   String fitPage = "<table>" + geDecoratorHTMLRow() + "<tr><td>invalidClass</td></tr></table>";
   Dispatcher dispatcher = new Dispatcher();
   dispatcher.doTables(new Parse(fitPage));
   assertEquals(1, dispatcher.counts.exceptions);
   String encapsulatedFixtureName =
       (String) dispatcher.summary.get(FixtureDecorator.ENCAPSULATED_FIXTURE_NAME);
   assertEquals("invalidClass", encapsulatedFixtureName);
 }
 @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);
 }
 @Test
 public void testShouldStripFirstRowAndPassRestOfTheTableToEncapsulatedFixture() throws Exception {
   String fitPage =
       "<table>"
           + geDecoratorHTMLRow()
           + "<tr><td>"
           + TestFixture.class.getName()
           + "</td></tr></table>";
   Dispatcher dispatcher = new Dispatcher();
   dispatcher.doTables(new Parse(fitPage));
   String expectedTableContents =
       "<table><tr><td>" + TestFixture.class.getName() + "</td></tr></table>";
   assertEquals(expectedTableContents, dispatcher.summary.get(TestFixture.TABLE_CONTENTS));
 }