source: class ChatTest extends DefaultComponent {
  
      @Test
      public void testUpdateForNewMessage() throws InterruptedException {
  
target:         //This test will create new messages and will verify that
          // the messages would be rendered
          final ExampleChatPage page = createTestPage(testUIEngine);
          page.init();
          ModificationManager m = page.getModificationManager();
         
          //test 1: Add a message and verfiy that it is shown in the initial page
          DocumentCollections.MESSAGES.addMessage("TestMessage1");
          String intialHTML = page.getInitialHTMLCode();
          assertTrue(intialHTML + " did not contain TestMessage1", intialHTML.contains("TestMessage1"));
          System.out.println("initialHTML:\n" + intialHTML);
          
          //test 2: Add another message and test that is included in the resulting pageUpdate 
          DocumentCollections.MESSAGES.addMessage("TestMessage2");
          String ajaxDelta = m.getModificiationXML();
          assertTrue(ajaxDelta + " did not contain TestMessage2", ajaxDelta.contains("TestMessage2"));      
      }
  
  }