Class TryFailThrowable

All Implemented Interfaces:
BugChecker.TryTreeMatcher, Suppressible, Serializable

public class TryFailThrowable extends BugChecker implements BugChecker.TryTreeMatcher
A bug checker for the following code pattern:
 try {
   // do something; // or any Assert.assert*
   // maybe do something more
 } catch (Throwable t) {
   // empty or only comments
* Matches all static methods named "fail" and starting with "assert" from the following classes:
  • org.junit.Assert,
  • junit.framework.Assert,
  • junit.framework.TestCase - which overrides the methods from Assert in order to deprecate them and
  • every class whose name ends with "MoreAsserts".
Possible improvements/generalizations of this matcher:
  • support multiple catch() blocks
Author: (Adam Wos)
See Also: