Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2011-01-27 07:50:19 +0000
committerEike Stepper2011-01-27 07:50:19 +0000
commite3874096c41e25bb288e45a0c273df548a88a075 (patch)
treea5de12dc12da3e8d837da77fda48917701d56d3a /plugins/org.eclipse.net4j.tests
parentc814770c337a877203acad7bb09cc71aad6a76b2 (diff)
downloadcdo-e3874096c41e25bb288e45a0c273df548a88a075.tar.gz
cdo-e3874096c41e25bb288e45a0c273df548a88a075.tar.xz
cdo-e3874096c41e25bb288e45a0c273df548a88a075.zip
added AbstractOMTest.getCodeLink()
Diffstat (limited to 'plugins/org.eclipse.net4j.tests')
-rw-r--r--plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
index 1b33f0d3c6..b6c463f277 100644
--- a/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
+++ b/plugins/org.eclipse.net4j.tests/src/org/eclipse/net4j/util/tests/AbstractOMTest.java
@@ -55,6 +55,8 @@ public abstract class AbstractOMTest extends TestCase
private static boolean consoleEnabled;
+ private transient String codeLink;
+
static
{
try
@@ -76,9 +78,46 @@ public abstract class AbstractOMTest extends TestCase
{
}
+ public String getCodeLink()
+ {
+ return codeLink;
+ }
+
+ public void determineCodeLink()
+ {
+ if (codeLink == null)
+ {
+ codeLink = determineCodeLink(getName());
+ if (codeLink == null)
+ {
+ codeLink = determineCodeLink("doSetUp");
+ if (codeLink == null)
+ {
+ codeLink = getClass().getName() + "." + getName() + "(" + getClass().getSimpleName() + ".java:1)";
+ }
+ }
+ }
+ }
+
+ protected String determineCodeLink(String methodName)
+ {
+ String className = getClass().getName();
+ StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace();
+ for (StackTraceElement frame : stackTrace)
+ {
+ if (frame.getClassName().equals(className) && frame.getMethodName().equals(methodName))
+ {
+ return frame.toString();
+ }
+ }
+
+ return null;
+ }
+
@Override
public void setUp() throws Exception
{
+ codeLink = null;
enableConsole();
if (!SUPPRESS_OUTPUT)
{

Back to the top