Clover Coverage Report
Coverage timestamp: Fri May 24 2013 13:47:27 UTC
28   92   9   3.5
0   55   0.32   8
8     1.12  
1    
 
  AbstractStateTest       Line # 29 28 9 97.2% 0.9722222
 
  (7)
 
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.state;
17   
18    import java.util.HashSet;
19    import java.util.Set;
20   
21    import org.qedeq.base.test.QedeqTestCase;
22   
23   
24    /**
25    * Test class.
26    *
27    * @author Michael Meyling
28    */
 
29    public class AbstractStateTest extends QedeqTestCase {
30   
31    private AbstractState instance1;
32   
33    private AbstractState instance2;
34   
35    private AbstractState instance3;
36   
 
37  7 toggle public void setUp() throws Exception {
38  7 super.setUp();
39  7 instance1 = new AbstractState("A Text", true, 13) {};
40  7 instance2 = new AbstractState("A Text", true, 13) {};
41  7 instance3 = new AbstractState("Another Text", false, 7) {};
42    }
43   
 
44  1 toggle public void testConstructor() {
45  1 try {
46  1 new AbstractState(null, true, 0) {};
47  0 fail("Exception expected");
48    } catch (RuntimeException e) {
49    // ok
50    }
51    }
52   
 
53  1 toggle public void testGetCode() {
54  1 assertEquals(13, instance1.getCode());
55  1 assertEquals(13, instance2.getCode());
56  1 assertEquals(7, instance3.getCode());
57    }
58   
 
59  1 toggle public void testGetText() {
60  1 assertEquals("A Text", instance1.getText());
61  1 assertEquals("A Text", instance2.getText());
62  1 assertEquals("Another Text", instance3.getText());
63    }
64   
 
65  1 toggle public void testToString() {
66  1 assertEquals("A Text", instance1.toString());
67  1 assertEquals("A Text", instance2.toString());
68  1 assertEquals("Another Text", instance3.toString());
69    }
70   
 
71  1 toggle public void testIsFailure() {
72  1 assertTrue(instance1.isFailure());
73  1 assertTrue(instance2.isFailure());
74  1 assertFalse(instance3.isFailure());
75    }
76   
 
77  1 toggle public void testEquals() {
78  1 assertFalse(instance1.equals(instance2));
79  1 assertFalse(instance1.equals(instance3));
80  1 assertTrue(instance1.equals(instance1));
81  1 assertTrue(instance3.equals(instance3));
82    }
83   
 
84  1 toggle public void testHashCode() {
85  1 final Set codes = new HashSet();
86  1 codes.add(new Integer(instance1.hashCode()));
87  1 codes.add(new Integer(instance2.hashCode()));
88  1 codes.add(new Integer(instance3.hashCode()));
89  1 assertEquals(2, codes.size());
90    }
91   
92    }