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