Skip to content

Commit e80cae8

Browse files
committed
[#1161] Add a test for hidden parameter
1 parent 9cb01e0 commit e80cae8

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

qulice-checkstyle/src/test/java/com/qulice/checkstyle/CheckstyleValidatorTest.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,25 @@ void rejectsUppercaseAbbreviations() throws Exception {
692692
);
693693
}
694694

695+
@Test
696+
@SuppressWarnings("unchecked")
697+
void rejectsHiddenParameters() throws Exception {
698+
final String file = "HiddenParameter.java";
699+
final Collection<Violation> results = this.runValidation(
700+
file, false
701+
);
702+
final String name = "HiddenFieldCheck";
703+
final String message = "'test' hides a field.";
704+
MatcherAssert.assertThat(
705+
results,
706+
Matchers.hasItems(
707+
new ViolationMatcher(
708+
message, file, "17", name
709+
)
710+
)
711+
);
712+
}
713+
695714
/**
696715
* CheckstyleValidator can allow IT as an uppercase abbreviation.
697716
*
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Hello.
3+
*/
4+
package foo;
5+
6+
/**
7+
* Hidden paramater test.
8+
* @since 1.0
9+
*/
10+
class HiddenParameter {
11+
private final String test = "";
12+
13+
/**
14+
* Some documentation for the function.
15+
* @param test Test
16+
*/
17+
void bar(final String test) { // error is here
18+
System.out.println("Hello: " + test);
19+
}
20+
}

0 commit comments

Comments
 (0)