Clover coverage report - angkor - 0.4
Coverage timestamp: ti okt 15 2002 22:32:48 CEST
file stats: LOC: 101   Methods: 6
NCLOC: 73   Classes: 1
Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover.
 
 Source file Conditionals Statements Methods TOTAL
ApplicationTest.java - 79,2% 66,7% 76,7%
 1   
 /*
 2   
  * Angkor Web Framework
 3   
  *
 4   
  * Distributable under LGPL license.
 5   
  * See terms of license at gnu.org.
 6   
  */
 7   
 package com.tirsen.angkor.test.unit;
 8   
 
 9   
 import junit.framework.TestCase;
 10   
 import com.tirsen.angkor.Application;
 11   
 import com.tirsen.angkor.ViewLink;
 12   
 import com.tirsen.angkor.ViewFactory;
 13   
 import com.tirsen.angkor.View;
 14   
 import com.tirsen.angkor.widget.TextLabel;
 15   
 
 16   
 /**
 17   
  * TODO document ApplicationTest
 18   
  *
 19   
  * <!-- $Id: ApplicationTest.java,v 1.1 2002/10/13 13:37:26 tirsen Exp $ -->
 20   
  *
 21   
  * @author $Author: tirsen $
 22   
  * @version $Revision: 1.1 $
 23   
  */
 24   
 public class ApplicationTest extends TestCase
 25   
 {
 26   
     Application application = new Application();
 27   
     public ViewFactory viewFactory = new ViewFactory()
 28   
             {
 29  0
                 public View getView()
 30   
                 {
 31  0
                     return null;
 32   
                 }
 33   
             };
 34   
 
 35  1
     public void testMethods()
 36   
     {
 37   
         // test valueUnbound method
 38  1
         application.valueUnbound(null);
 39   
 
 40   
         // test getWindowTitle method
 41  1
         assertNull(application.getWindowTitle());
 42   
     }
 43   
 
 44  1
     public void testRegisterComponent()
 45   
     {
 46  1
         try
 47   
         {
 48  1
             application.getComponent("no-component-here");
 49  0
             fail();
 50   
         }
 51   
         catch (IllegalArgumentException shouldHappen)
 52   
         {
 53   
         }
 54   
 
 55  1
         application.registerComponent("test", viewFactory);
 56  1
         assertSame(viewFactory, application.getComponent("test"));
 57  1
         try
 58   
         {
 59  1
             application.registerComponent("test", viewFactory);
 60  0
             fail();
 61   
         }
 62   
         catch (IllegalStateException shouldHappen)
 63   
         {
 64   
         }
 65   
     }
 66   
 
 67  1
     public void testAllocateUniqueID()
 68   
     {
 69  1
         TextLabel view = new TextLabel();
 70  1
         view.setId("test");
 71   
         // allocate same to same id twice should work
 72  1
         application.allocateUniqueID("test", view);
 73  1
         application.allocateUniqueID("test", view);
 74   
 
 75  1
         try
 76   
         {
 77  1
             application.allocateUniqueID("test", new TextLabel());
 78  0
             fail("allocate other to same id should not work");
 79   
         }
 80   
         catch (IllegalArgumentException shouldHappen)
 81   
         {
 82   
         }
 83   
     }
 84   
 
 85  1
     public void testViewLink()
 86   
     {
 87  1
         application.registerLink("link", viewFactory);
 88  1
         assertSame(viewFactory, application.getComponent("link"));
 89   
 
 90  1
         ViewFactory viewFactory2 = new ViewFactory()
 91   
         {
 92  0
             public View getView()
 93   
             {
 94  0
                 return null;
 95   
             }
 96   
         };
 97  1
         application.relink("link", viewFactory2);
 98  1
         assertSame(viewFactory2, application.getComponent("link"));
 99   
     }
 100   
 }
 101