Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
44   115   8   5.5
0   68   0.18   8
8     1  
1    
 
  RuleKeyTest       Line # 25 44 8 96.2% 0.96153843
 
  (4)
 
1    /* This file is part of the project "Hilbert II" - http://www.qedeq.org
2    *
3    * Copyright 2000-2013, Michael Meyling <mime@qedeq.org>.
4    *
5    * "Hilbert II" is free software; you can redistribute
6    * it and/or modify it under the terms of the GNU General Public
7    * License as published by the Free Software Foundation; either
8    * version 2 of the License, or (at your option) any later version.
9    *
10    * This program is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13    * GNU General Public License for more details.
14    */
15   
16    package org.qedeq.kernel.se.common;
17   
18    import org.qedeq.base.test.QedeqTestCase;
19   
20    /**
21    * Test class.
22    *
23    * @author Michael Meyling
24    */
 
25    public class RuleKeyTest extends QedeqTestCase {
26   
27    private RuleKey empty;
28   
29    private RuleKey one;
30   
31    private RuleKey two;
32   
33    private RuleKey three;
34   
 
35  0 toggle public RuleKeyTest(){
36  0 super();
37    }
38   
 
39  4 toggle public RuleKeyTest(final String name){
40  4 super(name);
41    }
42   
 
43  4 toggle protected void setUp() throws Exception {
44  4 super.setUp();
45  4 empty = new RuleKey(null, null);
46  4 one = new RuleKey("one", "1.00.00");
47  4 two = new RuleKey("two", "0.00.99");
48  4 three = new RuleKey("two", "0.00.99");
49    }
50   
 
51  4 toggle protected void tearDown() throws Exception {
52  4 empty = null;
53  4 one = null;
54  4 two = null;
55  4 three = null;
56  4 super.tearDown();
57    }
58   
59    /**
60    * Test getter.
61    */
 
62  1 toggle public void testGet() throws Exception {
63  1 assertEquals(null, empty.getName());
64  1 assertEquals(null, empty.getVersion());
65  1 assertEquals("one", one.getName());
66  1 assertEquals("1.00.00", one.getVersion());
67  1 assertEquals("two", two.getName());
68  1 assertEquals("0.00.99", two.getVersion());
69  1 assertEquals("two", three.getName());
70  1 assertEquals("0.00.99", three.getVersion());
71    }
72   
73    /**
74    * Test toString.
75    */
 
76  1 toggle public void testToString() throws Exception {
77  1 assertEquals("null [null]", empty.toString());
78  1 assertEquals("one [1.00.00]", one.toString());
79  1 assertEquals("two [0.00.99]", two.toString());
80  1 assertEquals("two [0.00.99]", three.toString());
81    }
82   
83    /**
84    * Test hashCode.
85    */
 
86  1 toggle public void testHashCode() throws Exception {
87  1 assertEquals(0 , empty.hashCode());
88  1 assertFalse(empty.hashCode() == one.hashCode());
89  1 assertFalse(two.hashCode() == one.hashCode());
90  1 assertTrue(two.hashCode() == three.hashCode());
91    }
92   
93    /**
94    * Test equals.
95    */
 
96  1 toggle public void testEquals() throws Exception {
97  1 assertFalse(empty.equals(null));
98  1 assertFalse(empty.equals(one));
99  1 assertFalse(empty.equals(two));
100  1 assertFalse(empty.equals(three));
101  1 assertFalse(one.equals(null));
102  1 assertTrue(one.equals(one));
103  1 assertFalse(one.equals(two));
104  1 assertFalse(one.equals(three));
105  1 assertFalse(two.equals(null));
106  1 assertFalse(two.equals(one));
107  1 assertTrue(two.equals(two));
108  1 assertTrue(two.equals(three));
109  1 assertFalse(three.equals(null));
110  1 assertFalse(three.equals(one));
111  1 assertTrue(three.equals(two));
112  1 assertTrue(three.equals(three));
113    }
114   
115    }