diff options
author | mwebster <mwebster> | 2006-08-09 15:53:53 +0000 |
---|---|---|
committer | mwebster <mwebster> | 2006-08-09 15:53:53 +0000 |
commit | 7a0f7a45b24c8dc9c63141edcb57f80f4a358f63 (patch) | |
tree | 0d9888f646dc8779f581da46a5c47893633ee3db /weaver/testsrc | |
parent | e42bdf150dc7dda76eacf36cdb8d7ea1baa75a9e (diff) | |
download | aspectj-7a0f7a45b24c8dc9c63141edcb57f80f4a358f63.tar.gz aspectj-7a0f7a45b24c8dc9c63141edcb57f80f4a358f63.zip |
Bug 150487 "Tracing and Logging Framework" (support debug, info, warn, error and fatal)
Diffstat (limited to 'weaver/testsrc')
3 files changed, 86 insertions, 70 deletions
diff --git a/weaver/testsrc/org/aspectj/weaver/AbstractTraceTest.java b/weaver/testsrc/org/aspectj/weaver/AbstractTraceTest.java new file mode 100644 index 000000000..abdff5fcb --- /dev/null +++ b/weaver/testsrc/org/aspectj/weaver/AbstractTraceTest.java @@ -0,0 +1,83 @@ +/******************************************************************************* + * Copyright (c) 2006 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Matthew Webster - initial implementation + *******************************************************************************/ +package org.aspectj.weaver; + +import junit.framework.TestCase; + +import org.aspectj.weaver.tools.AbstractTrace; +import org.aspectj.weaver.tools.DefaultTrace; + +public class AbstractTraceTest extends TestCase { + + protected AbstractTrace trace; + + public void testIsTraceEnabled() { + DefaultTrace trace = new DefaultTrace(getClass()); + assertFalse(trace.isTraceEnabled()); + } + + public void testEnterWithThisAndArgs() { + trace.enter("testEnterWithThisAndArgs",this,new Object[] { "arg1", "arg2" }); + } + + public void testEnterWithThis() { + trace.enter("testEnterWithThis",this); + } + + public void testEnter() { + trace.enter("testEnter"); + } + + public void testExitWithReturn() { + trace.exit("testExitWithReturn","ret"); + } + + public void testExitWithThrowable() { + trace.exit("testExitWithThrowable",new RuntimeException()); + } + + public void testExit() { + trace.exit("testExit"); + } + + public void testDebug() { + trace.debug("debug"); + } + + public void testInfo() { + trace.info("information"); + } + + public void testWarn() { + trace.warn("warning"); + } + + public void testWarnWithException() { + trace.warn("warning",new RuntimeException("warning")); + } + + public void testError() { + trace.error("error"); + } + + public void testErrorWithException() { + trace.error("error",new RuntimeException("error")); + } + + public void testFatal() { + trace.fatal("fatal"); + } + + public void testFatalWithException() { + trace.fatal("fatal",new RuntimeException("fatal")); + } + +} diff --git a/weaver/testsrc/org/aspectj/weaver/CommonsTraceTest.java b/weaver/testsrc/org/aspectj/weaver/CommonsTraceTest.java index ccc074be1..1ff47c45a 100644 --- a/weaver/testsrc/org/aspectj/weaver/CommonsTraceTest.java +++ b/weaver/testsrc/org/aspectj/weaver/CommonsTraceTest.java @@ -12,51 +12,18 @@ package org.aspectj.weaver; import org.aspectj.weaver.tools.CommonsTrace; -import junit.framework.TestCase; - -public class CommonsTraceTest extends TestCase { - - private CommonsTrace trace; +public class CommonsTraceTest extends AbstractTraceTest { protected void setUp() throws Exception { super.setUp(); trace = new CommonsTrace(getClass()); trace.setTraceEnabled(true); } - + public void testCommonsTrace() { CommonsTrace trace = new CommonsTrace(getClass()); } - public void testEnterWithThisAndArgs() { - trace.enter("testEnterWithThisAndArgs",this,new Object[] { "arg1", "arg2" }); - } - - public void testEnterWithThis() { - trace.enter("testEnterWithThis",this); - } - - public void testEnter() { - trace.enter("testEnter"); - } - - public void testExitWithReturn() { - trace.exit("testExitWithReturn","ret"); - } - - public void testExitWithThrowable() { - trace.exit("testExitWithThrowable",new RuntimeException()); - } - - public void testExit() { - trace.exit("testExit"); - } - - public void testIsTraceEnabled() { - CommonsTrace trace = new CommonsTrace(getClass()); - assertFalse(trace.isTraceEnabled()); - } - public void testSetTraceEnabled() { CommonsTrace trace = new CommonsTrace(getClass()); trace.setTraceEnabled(true); diff --git a/weaver/testsrc/org/aspectj/weaver/DefaultTraceTest.java b/weaver/testsrc/org/aspectj/weaver/DefaultTraceTest.java index 784c20992..b582d9bc4 100644 --- a/weaver/testsrc/org/aspectj/weaver/DefaultTraceTest.java +++ b/weaver/testsrc/org/aspectj/weaver/DefaultTraceTest.java @@ -10,14 +10,10 @@ *******************************************************************************/ package org.aspectj.weaver; -import junit.framework.TestCase; - import org.aspectj.weaver.tools.DefaultTrace; -public class DefaultTraceTest extends TestCase { +public class DefaultTraceTest extends AbstractTraceTest { - private DefaultTrace trace; - protected void setUp() throws Exception { super.setUp(); trace = new DefaultTrace(getClass()); @@ -28,39 +24,9 @@ public class DefaultTraceTest extends TestCase { DefaultTrace trace = new DefaultTrace(getClass()); } - public void testEnterWithThisAndArgs() { - trace.enter("testEnterWithThisAndArgs",this,new Object[] { "arg1", "arg2" }); - } - - public void testEnterWithThis() { - trace.enter("testEnterWithThis",this); - } - - public void testEnter() { - trace.enter("testEnter"); - } - - public void testExitWithReturn() { - trace.exit("testExitWithReturn","ret"); - } - - public void testExitWithThrowable() { - trace.exit("testExitWithThrowable",new RuntimeException()); - } - - public void testExit() { - trace.exit("testExit"); - } - - public void testIsTraceEnabled() { - DefaultTrace trace = new DefaultTrace(getClass()); - assertFalse(trace.isTraceEnabled()); - } - public void testSetTraceEnabled() { DefaultTrace trace = new DefaultTrace(getClass()); trace.setTraceEnabled(true); assertTrue(trace.isTraceEnabled()); } - } |