Skip to content
This repository was archived by the owner on Sep 10, 2022. It is now read-only.

Failing tests cause errors instead of failures #4

Open
DavidZemon opened this issue Feb 25, 2015 · 3 comments
Open

Failing tests cause errors instead of failures #4

DavidZemon opened this issue Feb 25, 2015 · 3 comments

Comments

@DavidZemon
Copy link

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;
        }
    }
@alasdairmackintosh
Copy link

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" [email protected] 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.

@alasdairmackintosh
Copy link

On Wed, Feb 25, 2015 at 8:15 AM, David Zemon [email protected]
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

@DavidZemon
Copy link
Author

Definitely understandable. I'd say take a look at the source code for ExceptionUtils.getRootCause and just implement it yourself.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants