Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A test throwing an unserializable InvocationTargetException passes as green #23

Open
jgrgt opened this issue Jul 6, 2015 · 0 comments

Comments

@jgrgt
Copy link

jgrgt commented Jul 6, 2015

TestVerticle.startTests() catches InvocationTargetExceptions, but in one of my Groovy-based tests, it caught a groovy.lang.MissingMethodException, and tries to handle it. This causes a serialization error in VertxAssert on line 51. This exception is uncaught, and causes no failure to be logged to Vertx, making the test pass as successful.

I tried 'fixing' this by again surrounding the VertxAssert.handleThrowable(targetEx); with a try/catch, but that messes up the output stream for some reason. I haven't found time to look deeper into it, so I don't have a patch to offer. I'm afraid. My workaround so far is to override startTests():


    @Override
    protected void startTests() {
        String methodName = container.config().getString("methodName");
        try {
            Method m = getClass().getDeclaredMethod(methodName);
            m.invoke(this);
        } catch (InvocationTargetException e) {
            // Conflict with Groovy causes sometimes silent InvocationTargetExceptions, so we always fail here.
            VertxAssert.fail(e.getMessage());
        } catch (Throwable t) {
            // Problem with invoking
            VertxAssert.handleThrowable(t);
        }
    }

The exception causing the problems:

groovy.lang.MissingMethodException: No signature of method: ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant