AppCode: debugger tests are more strict and verbose

This commit is contained in:
Anton Makeev
2013-07-03 11:24:54 +02:00
parent 795d1e98ab
commit 38a5ac33f2
3 changed files with 14 additions and 5 deletions
@@ -116,9 +116,13 @@ public class XDebuggerTestUtil {
}
public static List<XStackFrame> collectStacks(@NotNull XExecutionStack thread) throws InterruptedException {
return collectStacks(thread, TIMEOUT * 2);
}
public static List<XStackFrame> collectStacks(XExecutionStack thread, long timeout) throws InterruptedException {
XTestStackFrameContainer container = new XTestStackFrameContainer();
thread.computeStackFrames(0, container);
return container.waitFor(TIMEOUT * 2).first;
return container.waitFor(timeout).first;
}
public static Pair<XValue, String> evaluate(XDebugSession session, String expression) throws InterruptedException {
@@ -163,12 +167,16 @@ public class XDebuggerTestUtil {
}
public static XTestValueNode computePresentation(@NotNull XValue value) throws InterruptedException {
return computePresentation(value, TIMEOUT);
}
public static XTestValueNode computePresentation(XValue value, long timeout) throws InterruptedException {
XTestValueNode node = new XTestValueNode();
if (value instanceof XNamedValue) {
node.myName = ((XNamedValue)value).getName();
}
value.computePresentation(node, XValuePlace.TREE);
Assert.assertTrue("timed out", node.waitFor(TIMEOUT));
node.waitFor(timeout);
return node;
}
@@ -59,7 +59,8 @@ public class XTestContainer<T> {
}
public Pair<List<T>, String> waitFor(long timeout) throws InterruptedException {
XDebuggerTestUtil.waitFor(myFinished, timeout);
if (!XDebuggerTestUtil.waitFor(myFinished, timeout)) throw new AssertionError("Waiting timed out");
return new Pair<List<T>, String>(myChildren, myErrorMessage);
}
}
@@ -94,7 +94,7 @@ public class XTestValueNode implements XValueNode {
return false;
}
public boolean waitFor(long timeoutInMillis) throws InterruptedException {
return XDebuggerTestUtil.waitFor(myFinished, timeoutInMillis);
public void waitFor(long timeoutInMillis) throws InterruptedException {
if (!XDebuggerTestUtil.waitFor(myFinished, timeoutInMillis)) throw new AssertionError("Waiting timed out");
}
}