Promote anonymous class to nested class. #1555

Fixes `AnonymousClassMethodCount` inspection violation in test code.

Description:
>Reports anonymous inner class with too many methods. Anonymous classes with more than a very low number of methods may be difficult to understand, and should probably be promoted to become named inner classes.
This commit is contained in:
Michal Kordas 2015-08-17 22:40:05 +02:00 committed by Roman Ivanov
parent 06863d123f
commit a3fdd52b45
1 changed files with 18 additions and 16 deletions

View File

@ -35,22 +35,7 @@ import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
* @author lkuehne
*/
public class AbstractViolationReporterTest extends BaseCheckTestSupport {
private final Check emptyCheck = new Check() {
@Override
public int[] getDefaultTokens() {
return ArrayUtils.EMPTY_INT_ARRAY;
}
@Override
public int[] getAcceptableTokens() {
return ArrayUtils.EMPTY_INT_ARRAY;
}
@Override
public int[] getRequiredTokens() {
return ArrayUtils.EMPTY_INT_ARRAY;
}
};
private final Check emptyCheck = new EmptyCheck();
@Test
public void testGetMessageBundleWithPackage() {
@ -123,4 +108,21 @@ public class AbstractViolationReporterTest extends BaseCheckTestSupport {
//format
messages.first().getMessage();
}
private static class EmptyCheck extends Check {
@Override
public int[] getDefaultTokens() {
return ArrayUtils.EMPTY_INT_ARRAY;
}
@Override
public int[] getAcceptableTokens() {
return ArrayUtils.EMPTY_INT_ARRAY;
}
@Override
public int[] getRequiredTokens() {
return ArrayUtils.EMPTY_INT_ARRAY;
}
}
}