source: trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskAndIterationComparisonRuleTest.java @ 1190

Last change on this file since 1190 was 1190, checked in by pharms, 11 years ago
  • remove a find bugs warning
File size: 2.9 KB
Line 
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
15package de.ugoe.cs.autoquest.tasktrees.taskequality;
16
17import static org.junit.Assert.*;
18
19import org.junit.Test;
20
21import de.ugoe.cs.autoquest.eventcore.IEventTarget;
22import de.ugoe.cs.autoquest.eventcore.IEventType;
23import de.ugoe.cs.autoquest.eventcore.StringEventType;
24import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskAndIterationComparisonRule;
25import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality;
26import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration;
27import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection;
28import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder;
29import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
30import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory;
31import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder;
32import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory;
33import de.ugoe.cs.autoquest.test.DummyGUIElement;
34
35/**
36 * @author Patrick Harms
37 */
38public class TaskAndIterationComparisonRuleTest {
39
40    /**
41     *
42     */
43    @Test
44    public void test() {
45        ITaskFactory taskFactory = new TaskFactory();
46        ITaskBuilder treeBuilder = new TaskBuilder();
47       
48        TaskAndIterationComparisonRule rule = new TaskAndIterationComparisonRule();
49       
50        IEventType eventType1 = new StringEventType("eventType1");
51        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
52        ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1);
53       
54        assertNull(rule.compare(task1, task1));
55       
56        IIteration iteration1 = taskFactory.createNewIteration();
57        assertNull(rule.compare(iteration1, iteration1));
58        assertNull(rule.compare(task1, iteration1));
59        assertNull(rule.compare(iteration1, task1));
60
61        treeBuilder.setMarkedTask(iteration1, task1);
62       
63        assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration1, task1));
64        assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task1, iteration1));
65       
66        ISelection selection1 = taskFactory.createNewSelection();
67        treeBuilder.addChild(selection1, task1);
68        treeBuilder.setMarkedTask(iteration1, selection1);
69       
70        assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(iteration1, task1));
71        assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task1, iteration1));
72    }
73
74}
Note: See TracBrowser for help on using the repository browser.