Changeset 1294 for trunk/autoquest-test-utils/src/main/java/de/ugoe/cs/autoquest/tasktrees/TaskTreeValidator.java
- Timestamp:
- 08/14/13 17:04:42 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-test-utils/src/main/java/de/ugoe/cs/autoquest/tasktrees/TaskTreeValidator.java
r1146 r1294 20 20 21 21 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTask; 22 import de.ugoe.cs.autoquest.tasktrees.treeifc.IEventTaskInstance; 22 23 import de.ugoe.cs.autoquest.tasktrees.treeifc.IIteration; 24 import de.ugoe.cs.autoquest.tasktrees.treeifc.IIterationInstance; 23 25 import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptional; 26 import de.ugoe.cs.autoquest.tasktrees.treeifc.IOptionalInstance; 24 27 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelection; 28 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISelectionInstance; 25 29 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequence; 30 import de.ugoe.cs.autoquest.tasktrees.treeifc.ISequenceInstance; 26 31 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITask; 27 32 import de.ugoe.cs.autoquest.tasktrees.treeifc.ITaskInstance; … … 66 71 67 72 assertEquals("number of children of sequence instance must match sequence model", 68 taskInstance.size(), task.getChildren().size());73 ((ISequenceInstance) taskInstance).size(), task.getChildren().size()); 69 74 70 for (int i = 0; i < taskInstance.size(); i++) { 71 assertNotNull("sequence instance child " + i + " was null", taskInstance.get(i)); 72 ITask childTask = taskInstance.get(i).getTask(); 75 for (int i = 0; i < ((ISequenceInstance) taskInstance).size(); i++) { 76 assertNotNull("sequence instance child " + i + " was null", 77 ((ISequenceInstance) taskInstance).get(i)); 78 ITask childTask = ((ISequenceInstance) taskInstance).get(i).getTask(); 73 79 assertSame("task of sequence child " + i + " does not match sequence model", 74 80 childTask, task.getChildren().get(i)); … … 78 84 ISelection task = (ISelection) taskInstance.getTask(); 79 85 80 assert Equals81 ("number of children of selection instance must be 1", 1, taskInstance.size());86 assertNotNull("number of children of selection instance must be 1", 87 ((ISelectionInstance) taskInstance).getChild()); 82 88 assertTrue 83 89 ("number of children of selection must be larger 0", task.getChildren().size() > 0); … … 90 96 assertFalse("child of selection model must not be an optional", 91 97 childTask instanceof IOptional); 92 if (childTask.equals( taskInstance.get(0).getTask())) {98 if (childTask.equals(((ISelectionInstance) taskInstance).getChild().getTask())) { 93 99 found = true; 94 100 break; … … 107 113 childTask instanceof IOptional); 108 114 109 for (int i = 0; i < taskInstance.size(); i++) { 110 assertNotNull("iteration instance child " + i + " was null", taskInstance.get(i)); 115 for (int i = 0; i < ((IIterationInstance) taskInstance).size(); i++) { 116 assertNotNull("iteration instance child " + i + " was null", 117 ((IIterationInstance) taskInstance).get(i)); 111 118 assertSame("task of iteration child " + i + " does not match iteration model", 112 childTask, taskInstance.get(i).getTask());119 childTask, ((IIterationInstance) taskInstance).get(i).getTask()); 113 120 } 114 121 } … … 119 126 childTask instanceof IOptional); 120 127 121 assert Equals122 ("number of children of optional instance must be 1", 1, taskInstance.size());128 assertNotNull("number of children of optional instance must be 1", 129 ((IOptionalInstance) taskInstance).getChild()); 123 130 124 131 assertEquals("task of optional child does not match optional model", 125 childTask, taskInstance.get(0).getTask());132 childTask, ((IOptionalInstance) taskInstance).getChild().getTask()); 126 133 } 127 134 else if (taskInstance.getTask() instanceof IEventTask) { 128 135 IEventTask task = (IEventTask) taskInstance.getTask(); 129 136 assertNotNull("event task model must not be null", task); 130 assertNotNull("event type of event task model must not be null", task.getEventType()); 131 assertNotNull 132 ("event target of event task model must not be null", task.getEventTarget()); 133 134 assertEquals("event task instance must not have children", 0, taskInstance.size()); 137 assertNotNull("event of event task instance must not be null", 138 ((IEventTaskInstance) taskInstance).getEvent()); 135 139 } 136 140 else { … … 138 142 } 139 143 140 for (ITaskInstance child : taskInstance) { 141 validate(child); 144 if (taskInstance instanceof ITaskInstanceList) { 145 for (ITaskInstance child : (ITaskInstanceList) taskInstance) { 146 validate(child); 147 } 148 } 149 else if (taskInstance instanceof ISelectionInstance) { 150 validate(((ISelectionInstance) taskInstance).getChild()); 151 } 152 else if (taskInstance instanceof IOptionalInstance) { 153 validate(((IOptionalInstance) taskInstance).getChild()); 142 154 } 143 155 }
Note: See TracChangeset
for help on using the changeset viewer.