From 5d04f1d1900eaeae1ece62ba0824712de1192d15 Mon Sep 17 00:00:00 2001 From: rnveach Date: Sun, 23 Oct 2022 16:54:35 -0400 Subject: [PATCH] supplemental: resolve checkstyle violations from expanded search #444 --- config/sevntu_suppressions.xml | 2 ++ .../org/checkstyle/plugins/sonar/RunPluginTest.java | 12 +++--------- .../checkstyle/CheckstyleRulesDefinitionTest.java | 5 +++-- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/config/sevntu_suppressions.xml b/config/sevntu_suppressions.xml index ed60dc4a..9738511d 100644 --- a/config/sevntu_suppressions.xml +++ b/config/sevntu_suppressions.xml @@ -21,6 +21,8 @@ + + diff --git a/src/it/java/org/checkstyle/plugins/sonar/RunPluginTest.java b/src/it/java/org/checkstyle/plugins/sonar/RunPluginTest.java index 64eaa1e7..a485a6a1 100644 --- a/src/it/java/org/checkstyle/plugins/sonar/RunPluginTest.java +++ b/src/it/java/org/checkstyle/plugins/sonar/RunPluginTest.java @@ -103,15 +103,9 @@ public static void afterAll() { } @Test - public void testSonarExecution() { - try { - final MavenBuild build = testProjectBuild(); - executeBuildWithCommonProperties(build, true); - } - catch (IOException exception) { - LOG.error("Build execution error.", exception); - fail("Failed to execute build."); - } + public void testSonarExecution() throws IOException { + final MavenBuild build = testProjectBuild(); + executeBuildWithCommonProperties(build, true); } private static void executeBuildWithCommonProperties(Build build, boolean buildQuietly) diff --git a/src/test/java/org/sonar/plugins/checkstyle/CheckstyleRulesDefinitionTest.java b/src/test/java/org/sonar/plugins/checkstyle/CheckstyleRulesDefinitionTest.java index 03cf94bd..1000c702 100644 --- a/src/test/java/org/sonar/plugins/checkstyle/CheckstyleRulesDefinitionTest.java +++ b/src/test/java/org/sonar/plugins/checkstyle/CheckstyleRulesDefinitionTest.java @@ -24,6 +24,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.stream.Collectors; import org.junit.Rule; @@ -71,11 +72,11 @@ public void test() { }); final List duplicatedRuleWithTemplate = ruleCounts.entrySet().stream() .filter(entry -> entry.getValue() > 1) - .map(entry -> entry.getKey()) + .map(Entry::getKey) .collect(Collectors.toList()); final List rulesWithDuplicateTemplate = ruleCounts.entrySet().stream() .filter(entry -> entry.getValue() == 1) - .map(entry -> entry.getKey()) + .map(Entry::getKey) .collect(Collectors.toList()); // such number should not change during checkstyle version upgrade assertThat(duplicatedRuleWithTemplate).hasSize(0);