Talk:Small!

From WikiContent

Revision as of 00:12, 27 January 2009 by Michael Hunger (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

I'd rather refactor the code to create real domain objects for the collections: (See Kirks article on WET):

private void executeTestPages() throws Exception {
   TestSystems testSystems = TestSystems.filter(page,root,getSuiteFilter());
   testSystems.executeAll();
}

class TestSystems {
   List<PageList> systemsToTest=new LinkedList<PageList>();

   private TestSystems(List<PageList> systemsToTest) {
   	   this.pagesToTest.addAll(systemsToTest);
   }

   public static TestSystems filter(page,root, filter) {
     return new TestSystems(makeSuiteList(page, root, getSuiteFilter())); 
   }

   public void executeAll(Response response) {
   	  for (PageList systemPages : systemsToTest.values()) {
	      systemPages.execute(response);
	  }	  
   } 
}

class PageList {
      private final String name;
      private final List<WikiPage> pageList = new LinkedList<WikiPage>();
      public PageList(String name, List<WikiPage> pageList) {
      	     this.name=name;
	     this.pageList.addAll(pageList);
      }

      public void execute(Response response) {
      	   announceTest(response);
           startTestSystemAndExecutePages(name, pageList);
      }
      private void announceTest(Response response) {
           if (!response.isHtmlFormat()) return;
	   suiteFormatter.announceTestSystem(name);
	   addToResponse(suiteFormatter.getTestSystemHeader(name));
      }
}

-- Michael

Personal tools