Ignore:
Timestamp:
08/14/13 17:04:42 (11 years ago)
Author:
pharms
Message:
  • rework of task model to move event instance stuff to task instances
  • introduction of sequence, selection, iteration and optional instances
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/autoquest-core-tasktrees-test/src/test/java/de/ugoe/cs/autoquest/tasktrees/taskequality/TaskAndSelectionComparisonRuleTest.java

    r1190 r1294  
    2323import de.ugoe.cs.autoquest.eventcore.StringEventType; 
    2424import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskAndSelectionComparisonRule; 
    25 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
    2625import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
    27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 
    2826import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 
    29 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskFactory; 
    30 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskBuilder; 
    31 import de.ugoe.cs.autoquest.tasktrees.treeimpl.TaskFactory; 
    3227import de.ugoe.cs.autoquest.test.DummyGUIElement; 
    3328 
     
    3530 * @author Patrick Harms 
    3631 */ 
    37 public class TaskAndSelectionComparisonRuleTest { 
    38  
    39     /** 
    40      * 
    41      */ 
    42     @Test 
    43     public void test() { 
    44         ITaskFactory taskFactory = new TaskFactory(); 
    45         ITaskBuilder treeBuilder = new TaskBuilder(); 
    46          
    47         TaskAndSelectionComparisonRule rule = new TaskAndSelectionComparisonRule(); 
    48          
    49         IEventType eventType1 = new StringEventType("eventType1"); 
    50         IEventTarget eventTarget1 = new DummyGUIElement("elem1"); 
    51         ITask task1 = taskFactory.createNewEventTask(eventType1, eventTarget1); 
    52          
    53         assertNull(rule.compare(task1, task1)); 
    54          
    55         ISelection selection1 = taskFactory.createNewSelection(); 
    56         assertNull(rule.compare(selection1, selection1)); 
    57         assertNull(rule.compare(task1, selection1)); 
    58         assertNull(rule.compare(selection1, task1)); 
    59  
    60         treeBuilder.addChild(selection1, task1); 
    61          
    62         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection1, task1)); 
    63         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task1, selection1)); 
    64          
    65         selection1 = taskFactory.createNewSelection(); 
    66         ISelection selection2 = taskFactory.createNewSelection(); 
    67         treeBuilder.addChild(selection2, task1); 
    68         treeBuilder.addChild(selection1, selection2); 
    69          
    70         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(selection1, task1)); 
    71         assertEquals(TaskEquality.LEXICALLY_EQUAL, rule.compare(task1, selection1)); 
     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); 
    72266    } 
    73267 
Note: See TracChangeset for help on using the changeset viewer.