Changeset 1123
- Timestamp:
- 03/18/13 11:44:54 (12 years ago)
- Location:
- trunk/autoquest-test-utils/src/main/java/de/ugoe/cs/autoquest/tasktrees
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/autoquest-test-utils/src/main/java/de/ugoe/cs/autoquest/tasktrees/TaskTreeChecker.java
r1111 r1123 15 15 package de.ugoe.cs.autoquest.tasktrees; 16 16 17 import static org.junit.Assert.assertTrue; 18 import static org.junit.Assert.fail; 17 import static org.junit.Assert.*; 19 18 20 19 import java.io.FileNotFoundException; … … 108 107 109 108 /** 109 * <p> 110 * TODO: comment 111 * </p> 112 * 113 * @param oracle 114 * @param result 115 */ 116 public void assertTaskNodesEqual(ITaskTreeNode expected, ITaskTreeNode checked) { 117 if (expected == null) { 118 assertNull("null", checked); 119 } 120 else { 121 assertNotNull(expected.toString(), checked); 122 123 assertEquals(expected.toString() + ": types do not match", 124 expected.getClass(), checked.getClass()); 125 assertEquals(expected.toString() + ": names do not match", 126 expected.getName(), checked.getName()); 127 128 List<ITaskTreeNode> expectedChildren = expected.getChildren(); 129 List<ITaskTreeNode> checkedChildren = checked.getChildren(); 130 131 if ((expectedChildren != null) && (expectedChildren.size() > 0)) { 132 assertNotNull(expected.toString() + ": children not there", checkedChildren); 133 assertEquals(expected.toString() + ": different number of children", 134 expectedChildren.size(), checkedChildren.size()); 135 136 if (expected instanceof ISequence) { 137 for (int i = 0; i < expectedChildren.size(); i++) { 138 assertTaskNodesEqual(expectedChildren.get(i), checkedChildren.get(i)); 139 } 140 } 141 else { 142 for (int i = 0; i < expectedChildren.size(); i++) { 143 boolean found = false; 144 for (int j = 0; j < checkedChildren.size(); j++) { 145 try { 146 assertTaskNodesEqual 147 (expectedChildren.get(i), checkedChildren.get(j)); 148 found = true; 149 break; 150 } 151 catch (AssertionError e) { 152 // try next 153 } 154 } 155 156 assertTrue("one of the children not found", found); 157 } 158 } 159 } 160 else { 161 assertTrue(expected.toString() + ": unexpected children", 162 (checkedChildren == null) || (checkedChildren.size() == 0)); 163 } 164 } 165 } 166 167 /** 110 168 * TODO: comment 111 169 * … … 200 258 } 201 259 out.print(indent); 202 out.print("Sequence"); 203 if (node.getDescription() != null) { 204 out.print("("); 205 out.print(node.getDescription()); 206 out.print(")"); 207 } 260 out.print(node.toString()); 208 261 out.println(" {"); 209 262 } … … 213 266 } 214 267 out.print(indent); 215 out.print("Iteration"); 216 if (node.getDescription() != null) { 217 out.print("("); 218 out.print(node.getDescription()); 219 out.print(")"); 220 } 268 out.print(node.toString()); 221 269 out.println(" {"); 222 270 } … … 226 274 } 227 275 out.print(indent); 228 out.print("Selection"); 229 if (node.getDescription() != null) { 230 out.print("("); 231 out.print(node.getDescription()); 232 out.print(")"); 233 } 276 out.print(node.toString()); 234 277 out.println(" {"); 235 278 } 236 279 else if (node instanceof IEventTask) { 237 280 out.print(indent); 238 out.print(((IEventTask) node).getEventType() .getName());281 out.print(((IEventTask) node).getEventType()); 239 282 out.print(" "); 240 283 out.print(((IEventTask) node).getEventTarget().getStringIdentifier());
Note: See TracChangeset
for help on using the changeset viewer.