Clover Coverage Report - KS Common 1.1.0-SNAPSHOT (Aggregated)
Coverage timestamp: Tue Feb 15 2011 04:43:03 EST
22   63   5   4.4
0   51   0.23   5
5     1  
1    
 
  BinaryMessageTreeTest       Line # 15 22 0% 5 0 100% 1.0
 
  (4)
 
1    package org.kuali.student.common.messagebuilder.booleanmessage.ast;
2   
3    import java.util.HashMap;
4    import java.util.List;
5    import java.util.Map;
6   
7    import org.junit.Assert;
8    import org.junit.Before;
9    import org.junit.Test;
10    import org.kuali.student.common.messagebuilder.booleanmessage.BooleanMessage;
11    import org.kuali.student.common.messagebuilder.booleanmessage.ast.BinaryMessageTree;
12    import org.kuali.student.common.messagebuilder.booleanmessage.ast.BooleanMessageImpl;
13    import org.kuali.student.common.messagebuilder.booleanmessage.ast.BooleanNode;
14   
 
15    public class BinaryMessageTreeTest {
16    private Map<String,BooleanMessage> messageMap;
17   
 
18  4 toggle @Before
19    public void setUp() throws Exception {
20  4 messageMap = new HashMap<String, BooleanMessage>();
21  4 messageMap.put("A", new BooleanMessageImpl("A", true, "A is true"));
22  4 messageMap.put("B", new BooleanMessageImpl("B", true, "B is true"));
23    }
24   
 
25  1 toggle @Test
26    public void testGetRoot() throws Exception {
27  1 BinaryMessageTree btree = new BinaryMessageTree("en", messageMap);
28  1 BooleanNode rootNode = btree.buildTree("A*B");
29   
30  1 Assert.assertSame(rootNode, btree.getRoot());
31    }
32   
 
33  1 toggle @Test
34    public void testBuildTree() throws Exception {
35  1 BinaryMessageTree btree = new BinaryMessageTree("en", messageMap);
36  1 BooleanNode rootNode = btree.buildTree("A*B");
37   
38  1 Assert.assertEquals(2, rootNode.getChildren().size());
39  1 Assert.assertEquals("*", rootNode.getLabel());
40  1 Assert.assertEquals("A", rootNode.getLeftNode().getLabel());
41  1 Assert.assertEquals("B", rootNode.getRightNode().getLabel());
42    }
43   
 
44  1 toggle @Test
45    public void testTraverseTreePostOrder_GetAllNodes() throws Exception {
46  1 BinaryMessageTree btree = new BinaryMessageTree("en", messageMap);
47  1 BooleanNode rootNode = btree.buildTree("A*B");
48  1 btree.traverseTreePostOrder(rootNode, null);
49  1 List<BooleanNode> nodeList = btree.getAllNodes();
50   
51  1 Assert.assertEquals(3, nodeList.size());
52    }
53   
 
54  1 toggle @Test
55    public void testTraverseTreePostOrderDontSetNode_GetAllNodes2() throws Exception {
56  1 BinaryMessageTree btree = new BinaryMessageTree();
57  1 BooleanNode rootNode = btree.buildTree("A*B");
58  1 btree.traverseTreePostOrderDontSetNode(rootNode, null);
59  1 List<BooleanNode> nodeList = btree.getAllNodes();
60   
61  1 Assert.assertEquals(3, nodeList.size());
62    }
63    }