From 38a5ac33f271032f039cc63372d295fbf22320e2 Mon Sep 17 00:00:00 2001 From: Anton Makeev Date: Mon, 1 Jul 2013 20:18:12 +0200 Subject: [PATCH] AppCode: debugger tests are more strict and verbose --- .../com/intellij/xdebugger/XDebuggerTestUtil.java | 12 ++++++++++-- .../com/intellij/xdebugger/XTestContainer.java | 3 ++- .../com/intellij/xdebugger/XTestValueNode.java | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XDebuggerTestUtil.java b/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XDebuggerTestUtil.java index bd0c5412b450..c15dad59e4e2 100644 --- a/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XDebuggerTestUtil.java +++ b/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XDebuggerTestUtil.java @@ -116,9 +116,13 @@ public class XDebuggerTestUtil { } public static List collectStacks(@NotNull XExecutionStack thread) throws InterruptedException { + return collectStacks(thread, TIMEOUT * 2); + } + + public static List 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 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; } diff --git a/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XTestContainer.java b/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XTestContainer.java index c2efb05ff84d..286c965ee74b 100644 --- a/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XTestContainer.java +++ b/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XTestContainer.java @@ -59,7 +59,8 @@ public class XTestContainer { } public Pair, String> waitFor(long timeout) throws InterruptedException { - XDebuggerTestUtil.waitFor(myFinished, timeout); + if (!XDebuggerTestUtil.waitFor(myFinished, timeout)) throw new AssertionError("Waiting timed out"); + return new Pair, String>(myChildren, myErrorMessage); } } diff --git a/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XTestValueNode.java b/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XTestValueNode.java index e7a521606a42..6c4ba4681b05 100644 --- a/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XTestValueNode.java +++ b/platform/xdebugger-impl/testSrc/com/intellij/xdebugger/XTestValueNode.java @@ -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"); } }