[927] | 1 | // Copyright 2012 Georg-August-Universität Göttingen, Germany |
---|
| 2 | // |
---|
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
---|
| 4 | // you may not use this file except in compliance with the License. |
---|
| 5 | // You may obtain a copy of the License at |
---|
| 6 | // |
---|
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
---|
| 8 | // |
---|
| 9 | // Unless required by applicable law or agreed to in writing, software |
---|
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
---|
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
---|
| 12 | // See the License for the specific language governing permissions and |
---|
| 13 | // limitations under the License. |
---|
| 14 | |
---|
[922] | 15 | package de.ugoe.cs.autoquest.tasktrees.nodeequality; |
---|
[817] | 16 | |
---|
| 17 | import static org.junit.Assert.*; |
---|
| 18 | |
---|
| 19 | import org.junit.Test; |
---|
| 20 | |
---|
[922] | 21 | import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeAndIterationComparisonRule; |
---|
| 22 | import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEquality; |
---|
| 23 | import de.ugoe.cs.autoquest.tasktrees.nodeequality.NodeEqualityRuleManager; |
---|
| 24 | import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; |
---|
| 25 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; |
---|
| 26 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeBuilder; |
---|
| 27 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNode; |
---|
| 28 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskTreeNodeFactory; |
---|
| 29 | import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeBuilder; |
---|
| 30 | import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeNode; |
---|
| 31 | import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskTreeNodeFactory; |
---|
[817] | 32 | |
---|
| 33 | /** |
---|
| 34 | * @author Patrick Harms |
---|
| 35 | */ |
---|
| 36 | public class NodeAndIterationComparisonRuleTest { |
---|
| 37 | |
---|
| 38 | /** |
---|
| 39 | * |
---|
| 40 | */ |
---|
| 41 | @Test |
---|
| 42 | public void test() { |
---|
| 43 | NodeEqualityRuleManager manager = new NodeEqualityRuleManager(); |
---|
| 44 | manager.init(); |
---|
| 45 | |
---|
| 46 | ITaskTreeNodeFactory treeNodeFactory = new TaskTreeNodeFactory(); |
---|
| 47 | ITaskTreeBuilder treeBuilder = new TaskTreeBuilder(); |
---|
| 48 | |
---|
| 49 | NodeAndIterationComparisonRule rule = new NodeAndIterationComparisonRule(manager); |
---|
| 50 | |
---|
| 51 | ITaskTreeNode task1 = new TaskTreeNode("task1"); |
---|
| 52 | |
---|
| 53 | assertNull(rule.compare(task1, task1)); |
---|
| 54 | |
---|
| 55 | IIteration iteration1 = treeNodeFactory.createNewIteration(); |
---|
| 56 | assertNull(rule.compare(iteration1, iteration1)); |
---|
| 57 | assertNull(rule.compare(task1, iteration1)); |
---|
| 58 | assertNull(rule.compare(iteration1, task1)); |
---|
| 59 | |
---|
| 60 | treeBuilder.setChild(iteration1, task1); |
---|
| 61 | |
---|
| 62 | assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(iteration1, task1)); |
---|
| 63 | assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(task1, iteration1)); |
---|
| 64 | |
---|
| 65 | ISelection selection1 = treeNodeFactory.createNewSelection(); |
---|
| 66 | treeBuilder.addChild(selection1, task1); |
---|
| 67 | treeBuilder.setChild(iteration1, selection1); |
---|
| 68 | |
---|
| 69 | assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(iteration1, task1)); |
---|
| 70 | assertEquals(NodeEquality.LEXICALLY_EQUAL, rule.compare(task1, iteration1)); |
---|
| 71 | } |
---|
| 72 | |
---|
| 73 | } |
---|