Skip to content

Commit

Permalink
Address comments: Fix mutation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mohamedsamehsalah committed Oct 2, 2023
1 parent a91b936 commit 1c55636
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -128,20 +128,16 @@ public Description matchCompilationUnit(CompilationUnitTree tree, VisitorState s
if (IS_CONSTANT.matches(variableTree, state)
&& isFieldAccessModifierApplicable(variableTree, state)) {
VarSymbol variableSymbol = ASTHelpers.getSymbol(variableTree);
String variableName = variableSymbol.getSimpleName().toString();

if (variableSymbol != null) {
String variableName = variableSymbol.getSimpleName().toString();
if (!isVariableUpperSnakeCase(variableName) && !isVariableNameExcluded(variableName)) {
String replacement = toUpperSnakeCase(variableName);

if (!isVariableUpperSnakeCase(variableName)
&& !isVariableNameExcluded(variableName)) {
String replacement = toUpperSnakeCase(variableName);

if (variableSymbols.stream()
.noneMatch(s -> s.getSimpleName().toString().equals(replacement))) {
fixBuilder.merge(SuggestedFixes.renameVariable(variableTree, replacement, state));
} else {
reportConstantRenameBlocker(variableTree, replacement, state);
}
if (variableSymbols.stream()
.noneMatch(s -> s.getSimpleName().toString().equals(replacement))) {
fixBuilder.merge(SuggestedFixes.renameVariable(variableTree, replacement, state));
} else {
reportConstantRenameBlocker(variableTree, replacement, state);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ void excludeFlaggedConstants() {
}

@Test
void IncludePublicConstants() {
void includePublicConstants() {
BugCheckerRefactoringTestHelper.newInstance(CanonicalConstantFieldName.class, getClass())
.setArgs("-XepOpt:CanonicalConstantFieldName:IncludePublicConstantFields=true")
.addInputLines(
Expand Down

0 comments on commit 1c55636

Please sign in to comment.