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/TaskAndIterationComparisonRuleTest.java

    r1190 r1294  
    2323import de.ugoe.cs.autoquest.eventcore.StringEventType; 
    2424import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskAndIterationComparisonRule; 
    25 import de.ugoe.cs.autoquest.tasktrees.taskequality.TaskEquality; 
    2625import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 
    2726import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 
    28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskBuilder; 
    2927import 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; 
    3328import de.ugoe.cs.autoquest.test.DummyGUIElement; 
    3429 
     
    3631 * @author Patrick Harms 
    3732 */ 
    38 public 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)); 
     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); 
    72287    } 
    73288 
Note: See TracChangeset for help on using the changeset viewer.