Failing tests cause errors instead of failures
DavidZemon opened this issue · 3 comments
I've modified the first example in a simple fashion. I'm hoping maybe you could incorporate these changes into AnnotatedTestRunner.runTests(...)
:
@Test
public void testThreading() {
final AnnotatedTestRunner runner = new AnnotatedTestRunner();
// Run all Weaver tests in this class, using MyList as the Class Under Test.
try {
runner.runTests(this.getClass(), MyList.class);
} catch (final RuntimeException e) {
final Throwable root = org.apache.commons.lang.exception.ExceptionUtils.ExceptionUtils.getRootCause(e);
if (root instanceof AssertionError)
throw (AssertionError) root;
else
throw e;
}
}
Thanks for the update. I am a bit busy at the moment, but will take a look
in a few days.
Alasdair
On 25 Feb 2015 08:15, "David Zemon" notifications@github.com wrote:
I've modified the first example in a simple fashion. I'm hoping maybe you
could incorporate these changes into AnnotatedTestRunner.runTests(...):@Test public void testThreading() { final AnnotatedTestRunner runner = new AnnotatedTestRunner(); // Run all Weaver tests in this class, using MyList as the Class Under Test. try { runner.runTests(this.getClass(), MyList.class); } catch (final RuntimeException e) { final Throwable root = ExceptionUtils.getRootCause(e); if (root instanceof AssertionError) throw (AssertionError) root; else throw e; } }
—
Reply to this email directly or view it on GitHub
#4.
On Wed, Feb 25, 2015 at 8:15 AM, David Zemon notifications@github.com
wrote:
I've modified the first example in a simple fashion. I'm hoping maybe you
could incorporate these changes into AnnotatedTestRunner.runTests(...):@Test public void testThreading() { final AnnotatedTestRunner runner = new AnnotatedTestRunner(); // Run all Weaver tests in this class, using MyList as the Class Under Test. try { runner.runTests(this.getClass(), MyList.class); } catch (final RuntimeException e) { final Throwable root = ExceptionUtils.getRootCause(e); if (root instanceof AssertionError) throw (AssertionError) root; else throw e; } }
Hi David,
My only slight concern about doing this is that it would drag in yet
another dependency to the build, which already has a lot of dependencies.
How important do you think this is?
Alasdair
Definitely understandable. I'd say take a look at the source code for ExceptionUtils.getRootCause
and just implement it yourself.