While some ``++TestRule++`` classes have the desired effect without ever being directly referenced by a test, several others do not, and there's no reason to leave them cluttering up the file if they're not in use.
This rule raises an issue when ``++Test++`` class fields of the following types aren't used by any of the test methods: ``++TemporaryFolder++``, and ``++TestName++``.
This rule also applies to the JUnit 5 equivalent classes: ``++TempDir++``, and ``++TestInfo++``.
\[~david.gageot] this may not be as broad as you wanted...?
Also, I'm not quite sure about the impact of the @Rule annotation, so I didn't mention it in the description but left it in the code sample you provided. What happens if the annotation is missing?
=== on 12 May 2015, 14:54:12 David Gageot wrote:
If the annotation is missing, it will not do anything either. So this is really dead code