Clover coverage report -
Coverage timestamp: Fri Nov 19 2004 13:41:51 PST
file stats: LOC: 85   Methods: 9
NCLOC: 67   Classes: 2
 
 Source file Conditionals Statements Methods TOTAL
BeansTest.java - 96.3% 88.9% 94.4%
coverage coverage
 1    package photospace.beans;
 2   
 3    import junit.framework.*;
 4   
 5    public class BeansTest
 6    extends TestCase
 7    {
 8  1 public void testCopy() throws Exception
 9    {
 10  1 TestBean from = new TestBean("from1", "from2", "from3", "from4");
 11  1 TestBean to = new TestBean("to1", "to2", "to3", "to4");
 12   
 13  1 Beans.copy(from, to);
 14   
 15  1 assertEquals(from.getReadWrite1(), to.getReadWrite1());
 16  1 assertEquals(from.getReadWrite2(), to.getReadWrite2());
 17  1 assertEquals("to3", to.getReadOnly());
 18  1 assertEquals("to4", to.writeOnly);
 19    }
 20   
 21  1 public void testMerge() throws Exception
 22    {
 23  1 TestBean from = new TestBean("from1", "from2", "from3", "from4");
 24  1 TestBean to = new TestBean("to1", null, "to3", "to4");
 25   
 26  1 Beans.merge(from, to);
 27   
 28  1 assertEquals("to1", to.getReadWrite1());
 29  1 assertEquals(from.getReadWrite2(), to.getReadWrite2());
 30  1 assertEquals("to3", to.getReadOnly());
 31  1 assertEquals("to4", to.writeOnly);
 32   
 33  1 to = new TestBean("to1", "", "to3", "to4");
 34   
 35  1 Beans.merge(from, to);
 36   
 37  1 assertEquals(from.getReadWrite2(), to.getReadWrite2());
 38    }
 39   
 40    public static class TestBean
 41    {
 42    private String readWrite1;
 43    private String readWrite2;
 44    private String readOnly;
 45    private String writeOnly;
 46   
 47  5 public TestBean(String readWrite1, String readWrite2, String readOnly, String writeOnly)
 48    {
 49  5 this.readWrite1 = readWrite1;
 50  5 this.readWrite2 = readWrite2;
 51  5 this.readOnly = readOnly;
 52  5 this.writeOnly = writeOnly;
 53    }
 54   
 55  7 public String getReadWrite1()
 56    {
 57  7 return readWrite1;
 58    }
 59   
 60  1 public void setReadWrite1(String s)
 61    {
 62  1 readWrite1 = s;
 63    }
 64   
 65  2 public String getReadOnly()
 66    {
 67  2 return readOnly;
 68    }
 69   
 70  0 public void setWriteOnly(String s)
 71    {
 72  0 writeOnly = s;
 73    }
 74   
 75  12 public String getReadWrite2()
 76    {
 77  12 return readWrite2;
 78    }
 79   
 80  3 public void setReadWrite2(String readWrite2)
 81    {
 82  3 this.readWrite2 = readWrite2;
 83    }
 84    }
 85    }