[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 | |
---|
[1146] | 15 | package de.ugoe.cs.autoquest.tasktrees.taskequality; |
---|
[817] | 16 | |
---|
| 17 | import static org.junit.Assert.*; |
---|
| 18 | |
---|
| 19 | import org.junit.Test; |
---|
| 20 | |
---|
[1146] | 21 | import de.ugoe.cs.autoquest.eventcore.IEventTarget; |
---|
| 22 | import de.ugoe.cs.autoquest.eventcore.IEventType; |
---|
| 23 | import de.ugoe.cs.autoquest.eventcore.StringEventType; |
---|
| 24 | import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskAndIterationComparisonRule; |
---|
| 25 | import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; |
---|
[922] | 26 | import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; |
---|
| 27 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; |
---|
[1146] | 28 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; |
---|
| 29 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; |
---|
| 30 | import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; |
---|
| 31 | import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder; |
---|
| 32 | import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; |
---|
| 33 | import de.ugoe.cs.autoquest.test.DummyGUIElement; |
---|
[817] | 34 | |
---|
| 35 | /** |
---|
| 36 | * @author Patrick Harms |
---|
| 37 | */ |
---|
[1146] | 38 | public class TaskAndIterationComparisonRuleTest { |
---|
[817] | 39 | |
---|
| 40 | /** |
---|
| 41 | * |
---|
| 42 | */ |
---|
| 43 | @Test |
---|
| 44 | public void test() { |
---|
[1146] | 45 | ITaskFactory taskFactory = new TaskFactory(); |
---|
| 46 | ITaskBuilder treeBuilder = new TaskBuilder(); |
---|
[817] | 47 | |
---|
[1190] | 48 | TaskAndIterationComparisonRule rule = new TaskAndIterationComparisonRule(); |
---|
[817] | 49 | |
---|
[1146] | 50 | IEventType eventType1 = new StringEventType("eventType1"); |
---|
| 51 | IEventTarget eventTarget1 = new DummyGUIElement("elem1"); |
---|
| 52 | ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); |
---|
[817] | 53 | |
---|
| 54 | assertNull(rule.compare(task1, task1)); |
---|
| 55 | |
---|
[1146] | 56 | IIteration iteration1 = taskFactory.createNewIteration(); |
---|
[817] | 57 | assertNull(rule.compare(iteration1, iteration1)); |
---|
| 58 | assertNull(rule.compare(task1, iteration1)); |
---|
| 59 | assertNull(rule.compare(iteration1, task1)); |
---|
| 60 | |
---|
[1146] | 61 | treeBuilder.setMarkedTask(iteration1, task1); |
---|
[817] | 62 | |
---|
[1146] | 63 | assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration1, task1)); |
---|
| 64 | assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task1, iteration1)); |
---|
[817] | 65 | |
---|
[1146] | 66 | ISelection selection1 = taskFactory.createNewSelection(); |
---|
[817] | 67 | treeBuilder.addChild(selection1, task1); |
---|
[1146] | 68 | treeBuilder.setMarkedTask(iteration1, selection1); |
---|
[817] | 69 | |
---|
[1146] | 70 | assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration1, task1)); |
---|
| 71 | assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task1, iteration1)); |
---|
[817] | 72 | } |
---|
| 73 | |
---|
| 74 | } |
---|