Method 'xxx' is never used annotated with @Test in abstract parent

RE: IDEA 10.0.2

All,

    I have JUnit 4 style unit test classes.  I have a configuration with an abstract parent class and concrete subclasses.  I have a TestSuite that is configured with references to the concrete subclasses only.  IDEA's inspections are showing all the methods in the abstract parent class that are marked with @Test annotations as unused methods.  I really like the fact that IDEA 10 is now checking public and protected methods as well as private, so I'm willing to deal with this problem that impacts me in a very limited fashion, but if there's any workaround, I would be happy to hear about it.

Paul

2 comments
Comment actions Permalink

Paul,

you can annotate your parent class with @SuppressWarnings({"UnusedDeclaration"}). If you want to avoid this warning message for certain methods only, you can use the annotation on method level instead. Depending on what you want to achieve, you may also be able to use the @Parametrized runner and get rid of inheritance.

Hope that helps,
Dirk

0
Comment actions Permalink

Fixed. Thank you

0

Please sign in to leave a comment.