source: branches/autoquest-core-tasktrees-alignment-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskAndSelectionComparisonRuleTest.java @ 1735

Last change on this file since 1735 was 1294, checked in by pharms, 11 years ago
  • rework of task model to move event instance stuff to task instances
  • introduction of sequence, selection, iteration and optional instances
File size: 7.5 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.TaskAndSelectionComparisonRule;
25import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection;
26import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask;
27import de.ugoe.cs.autoquest.test.DummyGUIElement;
28
29/**
30 * @author Patrick Harms
31 */
32public class TaskAndSelectionComparisonRuleTest extends AbstractComparisonRuleTest {
33
34    /**
35     *
36     */
37    @Test
38    public void test_isApplicable_01() {
39        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule();
40       
41        ITask task1 = createNewSequence();
42       
43        assertFalse(rule.isApplicable(task1, task1));
44    }
45
46    /**
47     *
48     */
49    @Test
50    public void test_isApplicable_02() {
51        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule();
52       
53        ITask task1 = createNewSelection();
54       
55        assertFalse(rule.isApplicable(task1, task1));
56    }
57
58    /**
59     *
60     */
61    @Test
62    public void test_isApplicable_03() {
63        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule();
64       
65        ITask task1 = createNewIteration();
66       
67        assertFalse(rule.isApplicable(task1, task1));
68    }
69
70    /**
71     *
72     */
73    @Test
74    public void test_isApplicable_04() {
75        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule();
76       
77        ITask task1 = createNewOptional();
78       
79        assertFalse(rule.isApplicable(task1, task1));
80    }
81
82    /**
83     *
84     */
85    @Test
86    public void test_isApplicable_05() {
87        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule();
88       
89        IEventType eventType1 = new StringEventType("eventType1");
90        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
91
92        ITask task1 = createNewEventTask(eventType1, eventTarget1);
93       
94        assertFalse(rule.isApplicable(task1, task1));
95    }
96
97    /**
98     *
99     */
100    @Test
101    public void test_isApplicable_06() {
102        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule();
103
104        ITask task1 = createNewSelection();
105        ITask task2 = createNewSequence();
106       
107        assertTrue(rule.isApplicable(task1, task2));
108        assertTrue(rule.isApplicable(task2, task1));
109    }
110
111    /**
112     *
113     */
114    @Test
115    public void test_isApplicable_07() {
116        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule();
117
118        ITask task1 = createNewSelection();
119        ITask task2 = createNewIteration();
120       
121        assertTrue(rule.isApplicable(task1, task2));
122        assertTrue(rule.isApplicable(task2, task1));
123    }
124
125    /**
126     *
127     */
128    @Test
129    public void test_isApplicable_08() {
130        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule();
131
132        ITask task1 = createNewSelection();
133        ITask task2 = createNewOptional();
134       
135        assertTrue(rule.isApplicable(task1, task2));
136        assertTrue(rule.isApplicable(task2, task1));
137    }
138
139    /**
140     *
141     */
142    @Test
143    public void test_isApplicable_09() {
144        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule();
145
146        ITask task1 = createNewSelection();
147       
148        IEventType eventType1 = new StringEventType("eventType1");
149        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
150
151        ITask task2 = createNewEventTask(eventType1, eventTarget1);
152       
153        assertTrue(rule.isApplicable(task1, task2));
154        assertTrue(rule.isApplicable(task2, task1));
155    }
156
157    /**
158     *
159     */
160    @Test
161    public void test_isApplicable_10() {
162        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule();
163
164        ITask task1 = createNewSequence();
165        ITask task2 = createNewIteration();
166       
167        assertFalse(rule.isApplicable(task1, task2));
168        assertFalse(rule.isApplicable(task2, task1));
169    }
170
171    /**
172     *
173     */
174    @Test
175    public void test_isApplicable_11() {
176        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule();
177
178        ITask task1 = createNewSequence();
179        ITask task2 = createNewOptional();
180       
181        assertFalse(rule.isApplicable(task1, task2));
182        assertFalse(rule.isApplicable(task2, task1));
183    }
184
185    /**
186     *
187     */
188    @Test
189    public void test_isApplicable_12() {
190        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule();
191
192        ITask task1 = createNewSequence();
193       
194        IEventType eventType1 = new StringEventType("eventType1");
195        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
196
197        ITask task2 = createNewEventTask(eventType1, eventTarget1);
198       
199        assertFalse(rule.isApplicable(task1, task2));
200        assertFalse(rule.isApplicable(task2, task1));
201    }
202
203    /**
204     *
205     */
206    @Test
207    public void test_isApplicable_13() {
208        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule();
209
210        ITask task1 = createNewIteration();
211        ITask task2 = createNewOptional();
212       
213        assertFalse(rule.isApplicable(task1, task2));
214        assertFalse(rule.isApplicable(task2, task1));
215    }
216
217    /**
218     *
219     */
220    @Test
221    public void test_isApplicable_14() {
222        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule();
223
224        ITask task1 = createNewIteration();
225       
226        IEventType eventType1 = new StringEventType("eventType1");
227        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
228
229        ITask task2 = createNewEventTask(eventType1, eventTarget1);
230       
231        assertFalse(rule.isApplicable(task1, task2));
232        assertFalse(rule.isApplicable(task2, task1));
233    }
234
235    /**
236     *
237     */
238    @Test
239    public void test_compare_01() {
240        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule();
241       
242        IEventType eventType1 = new StringEventType("eventType1");
243        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
244        ITask task1 = createNewEventTask(eventType1, eventTarget1);
245       
246        ISelection selection1 = createNewSelection();
247       
248        assertNullEquality(rule, task1, selection1);
249    }
250
251    /**
252     *
253     */
254    @Test
255    public void test_compare_02() {
256        TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule();
257       
258        IEventType eventType1 = new StringEventType("eventType1");
259        IEventTarget eventTarget1 = new DummyGUIElement("elem1");
260        ITask task1 = createNewEventTask(eventType1, eventTarget1);
261       
262        ISelection selection1 = createNewSelection();
263        addChild(selection1, task1);
264       
265        assertLexicallyEqual(rule, task1, selection1);
266    }
267
268}
Note: See TracBrowser for help on using the repository browser.