Clover Coverage Report - perfectjpattern(Aggregated)
Coverage timestamp: Sat Feb 28 2009 14:35:07 CET
11   66   1   11
0   30   0.09   1
1     1  
1    
 
  TestProduct       Line # 32 11 0% 1 0 100% 1.0
 
  (1)
 
1    //----------------------------------------------------------------------
2    //
3    // PerfectJPattern: "Design patterns are good but components are better!"
4    // TestProduct.java Copyright (c) 2009 Giovanni Azua Garcia
5    // bravegag@hotmail.com
6    //
7    // This program is free software; you can redistribute it and/or
8    // modify it under the terms of the GNU General Public License
9    // as published by the Free Software Foundation; either version 3
10    // of the License, or (at your option) any later version.
11    //
12    // This program is distributed in the hope that it will be useful,
13    // but WITHOUT ANY WARRANTY; without even the implied warranty of
14    // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15    // GNU General Public License for more details.
16    //
17    // You should have received a copy of the GNU General Public License
18    // along with this program; if not, see <http://www.gnu.org/licenses/>.
19    //
20    //----------------------------------------------------------------------
21    package org.perfectjpattern.example.datamodel;
22   
23    import junit.framework.*;
24   
25    /**
26    * Test suite for the {@link Product} implementation
27    *
28    * @author <a href="mailto:bravegag@hotmail.com">Giovanni Azua</a>
29    * @version $ $Date: Jan 11, 2009 12:55:57 PM $
30    */
31    public
 
32    class TestProduct
33    extends TestCase
34    {
35    //------------------------------------------------------------------------
36    // public
37    //------------------------------------------------------------------------
 
38  1 toggle public void
39    testEquals()
40    {
41  1 Product myProduct1 = new Product("Nikon 80-400mm VR f/4.5-5.6", 2000.0);
42  1 Product myProduct2 = new Product("Nikon 80-400mm VR f/4.5-5.6", 2000.0);
43  1 Product myProduct3 = new Product("Nikon 17-55mm VR f/2.8", 1600.0);
44   
45  1 assertEquals("Product equals does not work as expected", myProduct1,
46    myProduct1);
47  1 assertEquals("Product equals does not work as expected", myProduct1.
48    hashCode(), myProduct1.hashCode());
49   
50  1 assertFalse("Product equals does not work as expected", myProduct1.
51    equals(null));
52   
53  1 assertFalse("Product equals does not work as expected", myProduct1.
54    equals(new Customer()));
55   
56  1 assertEquals("Product equals does not work as expected", myProduct1,
57    myProduct2);
58  1 assertEquals("Product equals does not work as expected", myProduct1.
59    hashCode(), myProduct2.hashCode());
60   
61  1 assertFalse("Product equals does not work as expected", myProduct2.
62    equals(myProduct3));
63  1 assertFalse("Product equals does not work as expected", myProduct2.
64    hashCode() == myProduct3.hashCode());
65    }
66    }