Update checkstyle to version 8.13

This commit is contained in:
pascalschumacher 2018-10-13 20:22:23 +02:00
parent e99b0dde8e
commit 46ea7e5e96
2 changed files with 31 additions and 11 deletions

View File

@ -618,6 +618,8 @@
<commons.encoding>utf-8</commons.encoding> <commons.encoding>utf-8</commons.encoding>
<checkstyle.plugin.version>3.0.0</checkstyle.plugin.version> <checkstyle.plugin.version>3.0.0</checkstyle.plugin.version>
<checkstyle.version>8.13</checkstyle.version>
<spotbugs.plugin.version>3.1.6</spotbugs.plugin.version> <spotbugs.plugin.version>3.1.6</spotbugs.plugin.version>
<japicmp.skip>false</japicmp.skip> <japicmp.skip>false</japicmp.skip>
@ -734,6 +736,13 @@
<includeTestSourceDirectory>true</includeTestSourceDirectory> <includeTestSourceDirectory>true</includeTestSourceDirectory>
<enableRulesSummary>false</enableRulesSummary> <enableRulesSummary>false</enableRulesSummary>
</configuration> </configuration>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle.version}</version>
</dependency>
</dependencies>
</plugin> </plugin>
<plugin> <plugin>
<groupId>com.github.spotbugs</groupId> <groupId>com.github.spotbugs</groupId>

View File

@ -474,18 +474,29 @@ public class RandomStringUtilsTest {
final String set = "abc"; final String set = "abc";
final char[] chars = set.toCharArray(); final char[] chars = set.toCharArray();
String gen = ""; String gen = "";
final int[] counts = {0,0,0}; final int[] counts = {0, 0, 0};
final int[] expected = {200,200,200}; final int[] expected = {200, 200, 200};
for (int i = 0; i< 100; i++) { for (int i = 0; i< 100; i++) {
gen = RandomStringUtils.random(6,chars); gen = RandomStringUtils.random(6,chars);
for (int j = 0; j < 6; j++) { for (int j = 0; j < 6; j++) {
switch (gen.charAt(j)) { switch (gen.charAt(j)) {
case 'a': {counts[0]++; break;} case 'a': {
case 'b': {counts[1]++; break;} counts[0]++;
case 'c': {counts[2]++; break;} break;
default: {fail("generated character not in set");} }
} case 'b': {
} counts[1]++;
break;
}
case 'c': {
counts[2]++;
break;
}
default: {
fail("generated character not in set");
}
}
}
} }
// Perform chi-square test with df = 3-1 = 2, testing at .001 level // Perform chi-square test with df = 3-1 = 2, testing at .001 level
assertTrue(chiSquare(expected,counts) < 13.82, "test homogeneity -- will fail about 1 in 1000 times"); assertTrue(chiSquare(expected,counts) < 13.82, "test homogeneity -- will fail about 1 in 1000 times");