Issue #1288: 'ParameterNameCheck' refactored, UT coverage improved
This commit is contained in:
parent
4fd6b3ee59
commit
fa8b3ed7e1
1
pom.xml
1
pom.xml
|
|
@ -877,7 +877,6 @@
|
|||
<regex><pattern>.*.checks.naming.MemberNameCheck</pattern><branchRate>91</branchRate><lineRate>85</lineRate></regex>
|
||||
<regex><pattern>.*.checks.naming.MethodNameCheck</pattern><branchRate>100</branchRate><lineRate>93</lineRate></regex>
|
||||
<regex><pattern>.*.checks.naming.PackageNameCheck</pattern><branchRate>100</branchRate><lineRate>88</lineRate></regex>
|
||||
<regex><pattern>.*.checks.naming.ParameterNameCheck</pattern><branchRate>75</branchRate><lineRate>80</lineRate></regex>
|
||||
|
||||
<regex><pattern>.*.checks.regexp.CommentSuppressor</pattern><branchRate>75</branchRate><lineRate>100</lineRate></regex>
|
||||
<regex><pattern>.*.checks.regexp.DetectorOptions</pattern><branchRate>100</branchRate><lineRate>96</lineRate></regex>
|
||||
|
|
|
|||
|
|
@ -69,8 +69,6 @@ public class ParameterNameCheck
|
|||
|
||||
@Override
|
||||
protected boolean mustCheckName(DetailAST ast) {
|
||||
return !(
|
||||
ast.getParent() != null
|
||||
&& ast.getParent().getType() == TokenTypes.LITERAL_CATCH);
|
||||
return ast.getParent().getType() != TokenTypes.LITERAL_CATCH;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,11 +19,14 @@
|
|||
|
||||
package com.puppycrawl.tools.checkstyle.checks.naming;
|
||||
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
import static com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck.MSG_INVALID_PATTERN;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import static com.puppycrawl.tools.checkstyle.checks.naming.AbstractNameCheck.MSG_INVALID_PATTERN;
|
||||
import com.puppycrawl.tools.checkstyle.BaseCheckTestSupport;
|
||||
import com.puppycrawl.tools.checkstyle.DefaultConfiguration;
|
||||
import com.puppycrawl.tools.checkstyle.api.TokenTypes;
|
||||
|
||||
public class ParameterNameCheckTest
|
||||
extends BaseCheckTestSupport {
|
||||
|
|
@ -64,4 +67,15 @@ public class ParameterNameCheckTest
|
|||
};
|
||||
verify(checkConfig, getPath("InputSimple.java"), expected);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAcceptableTokens() {
|
||||
ParameterNameCheck parameterNameCheckObj = new ParameterNameCheck();
|
||||
int[] actual = parameterNameCheckObj.getAcceptableTokens();
|
||||
int[] expected = new int[] {
|
||||
TokenTypes.PARAMETER_DEF,
|
||||
};
|
||||
Assert.assertNotNull(actual);
|
||||
Assert.assertArrayEquals(expected, actual);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue