Skip to content
This repository has been archived by the owner on Jan 12, 2021. It is now read-only.

Tests Throwing Anonymous Exceptions Pass #84

Open
MADiep opened this issue Aug 18, 2016 · 0 comments
Open

Tests Throwing Anonymous Exceptions Pass #84

MADiep opened this issue Aug 18, 2016 · 0 comments

Comments

@MADiep
Copy link

MADiep commented Aug 18, 2016

When a test encounters an "anonymous" Exception, JTAF stops that particular test's execution and marks it as passed. For example, this will cause JTAF to pass the test:

throw new RuntimeException() {};

This is caused in Interpreter#interpret(TestScript). Specifically, towards the end of the method these lines are executed:

if (failure != null && failure.getClass().getSimpleName().equalsIgnoreCase(test.getException())) {
  failure = null;
  this.testStatus = TestStatus.Passed;
}

Because the Exception is anonymous, the getSimpleName() method returns an empty String. In most cases, test.getException() will also be an empty String, causing the code to flip the status to passing.

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

1 participant