100% test coverage for com.puppycrawl.tools.checkstyle.checks.sizes, issue #1024

This commit is contained in:
MEZk 2015-06-05 02:30:06 +03:00
parent 8ef4a669c0
commit c2ca14da23
2 changed files with 4 additions and 9 deletions

View File

@ -854,8 +854,6 @@
<regex><pattern>.*.checks.regexp.RegexpSinglelineCheck</pattern><branchRate>100</branchRate><lineRate>76</lineRate></regex>
<regex><pattern>.*.checks.regexp.SinglelineDetector</pattern><branchRate>93</branchRate><lineRate>96</lineRate></regex>
<regex><pattern>.*.checks.sizes.MethodCountCheck</pattern><branchRate>95</branchRate><lineRate>100</lineRate></regex>
<regex><pattern>.*.checks.whitespace.AbstractParenPadCheck</pattern><branchRate>88</branchRate><lineRate>100</lineRate></regex>
<regex><pattern>.*.checks.whitespace.EmptyForInitializerPadCheck</pattern><branchRate>91</branchRate><lineRate>93</lineRate></regex>
<regex><pattern>.*.checks.whitespace.EmptyForIteratorPadCheck</pattern><branchRate>100</branchRate><lineRate>92</lineRate></regex>

View File

@ -158,16 +158,13 @@ public final class MethodCountCheck extends Check {
@Override
public void visitToken(DetailAST ast) {
if (TokenTypes.CLASS_DEF == ast.getType()
|| TokenTypes.INTERFACE_DEF == ast.getType()
|| TokenTypes.ENUM_CONSTANT_DEF == ast.getType()
|| TokenTypes.ENUM_DEF == ast.getType()) {
if (TokenTypes.METHOD_DEF == ast.getType()) {
raiseCounter(ast);
}
else {
final boolean inInterface = TokenTypes.INTERFACE_DEF == ast.getType();
counters.push(new MethodCounter(inInterface));
}
else if (TokenTypes.METHOD_DEF == ast.getType()) {
raiseCounter(ast);
}
}
@Override