Add test cases for one character lambda parameters and for loop variables

This commit is contained in:
Andreas Dangel
2018-07-23 16:44:58 +02:00
parent cab4234a1f
commit e6e188f301
2 changed files with 40 additions and 0 deletions

View File

@@ -47,6 +47,32 @@
]]></code>
</test-code>
<test-code>
<description>One character lambda Parameters should be allowed by default</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import java.util.function.Consumer;
public class Bar {
public void foo() {
Consumer<String> i = (s) -> {
};
Consumer<String> k = (String s) -> {
};
Consumer<String> l = (final String s) -> {
};
}
}
]]></code>
</test-code>
<test-code>
<description>Test method param pattern</description>
<rule-property name="methodParameterPattern">[A-Z]+</rule-property>

View File

@@ -118,5 +118,19 @@
]]></code>
</test-code>
<test-code>
<description>One character for loop variables should be ok by default</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
public class LocalVarNamingConvention {
public void bar() {
for (int i = 0; i < 10; i++) { }
List<String> data = Arrays.asList("a", "b");
for (String s : data) { }
}
}
]]></code>
</test-code>
</test-data>