diff --git a/pom.xml b/pom.xml index 8013d5b8ef5..96ff541ce58 100644 --- a/pom.xml +++ b/pom.xml @@ -62,7 +62,6 @@ 10.6.0.92116 17 ${jdk.min.version} - 33.2.1-jre 9.14.0.375 @@ -139,12 +138,6 @@ 5.12.0 test - - com.google.guava - guava - ${guava.version} - test - org.codehaus.woodstox stax2-api diff --git a/sonar-csharp-plugin/pom.xml b/sonar-csharp-plugin/pom.xml index 558100165fa..1d35557fe3e 100644 --- a/sonar-csharp-plugin/pom.xml +++ b/sonar-csharp-plugin/pom.xml @@ -90,10 +90,6 @@ org.mockito mockito-core - - com.google.guava - guava - org.codehaus.woodstox stax2-api diff --git a/sonar-csharp-plugin/src/test/java/org/sonar/plugins/csharp/CSharpPluginTest.java b/sonar-csharp-plugin/src/test/java/org/sonar/plugins/csharp/CSharpPluginTest.java index e2372fcc504..ccb6652c91f 100644 --- a/sonar-csharp-plugin/src/test/java/org/sonar/plugins/csharp/CSharpPluginTest.java +++ b/sonar-csharp-plugin/src/test/java/org/sonar/plugins/csharp/CSharpPluginTest.java @@ -19,15 +19,11 @@ */ package org.sonar.plugins.csharp; -import com.google.common.collect.ImmutableList; -import java.util.List; - import org.junit.jupiter.api.Test; import org.sonar.api.Plugin; import org.sonar.api.SonarEdition; import org.sonar.api.SonarQubeSide; import org.sonar.api.SonarRuntime; -import org.sonar.api.config.PropertyDefinition; import org.sonar.api.internal.SonarRuntimeImpl; import org.sonar.api.utils.Version; import org.sonarsource.dotnet.shared.plugins.AnalysisWarningsSensor; @@ -49,6 +45,7 @@ import org.sonarsource.dotnet.shared.plugins.WrongEncodingFileFilter; import static org.assertj.core.api.Assertions.assertThat; +import static org.sonarsource.dotnet.shared.PropertyUtils.nonProperties; class CSharpPluginTest { @@ -97,14 +94,4 @@ void getExtensions() { + new CSharpPropertyDefinitions(sonarRuntime).create().size()); } - private static List nonProperties(List extensions) { - ImmutableList.Builder builder = ImmutableList.builder(); - for (Object extension : extensions) { - if (!(extension instanceof PropertyDefinition)) { - builder.add(extension); - } - } - return builder.build(); - } - } diff --git a/sonar-csharp-plugin/src/test/java/org/sonar/plugins/csharp/CSharpSonarWayProfileTest.java b/sonar-csharp-plugin/src/test/java/org/sonar/plugins/csharp/CSharpSonarWayProfileTest.java index 06d70390f4f..69deef901b9 100644 --- a/sonar-csharp-plugin/src/test/java/org/sonar/plugins/csharp/CSharpSonarWayProfileTest.java +++ b/sonar-csharp-plugin/src/test/java/org/sonar/plugins/csharp/CSharpSonarWayProfileTest.java @@ -19,11 +19,11 @@ */ package org.sonar.plugins.csharp; -import com.google.common.collect.Sets; import com.sonar.plugins.security.api.CsRules; import java.lang.reflect.InvocationTargetException; import java.util.Collections; import java.util.HashSet; +import java.util.Set; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; @@ -57,7 +57,7 @@ void sonar_security_with_already_activated_rule() { Mockito.when(profile.activateRule(CSharpPlugin.REPOSITORY_KEY, "TEST")).thenThrow(IllegalArgumentException.class); Context context = Mockito.mock(Context.class); Mockito.when(context.createBuiltInQualityProfile(anyString(), anyString())).thenReturn(profile); - CsRules.ruleKeys = Sets.newHashSet("TEST"); + CsRules.ruleKeys = Set.of("TEST"); CSharpSonarWayProfile profileDef = new CSharpSonarWayProfile(); profileDef.define(context); @@ -73,7 +73,7 @@ void sonar_security_with_unknown_rule_repository() { Mockito.when(profile.activateRule("roslyn.TEST", "TEST")).thenThrow(IllegalStateException.class); Context context = Mockito.mock(Context.class); Mockito.when(context.createBuiltInQualityProfile(anyString(), anyString())).thenReturn(profile); - CsRules.ruleKeys = Sets.newHashSet("TEST"); + CsRules.ruleKeys = Set.of("TEST"); CsRules.returnRepository = true; CSharpSonarWayProfile profileDef = new CSharpSonarWayProfile(); @@ -85,7 +85,7 @@ void sonar_security_with_unknown_rule_repository() { @Test void sonar_security_with_custom_frontend_plugin() { Context context = new Context(); - CsRules.ruleKeys = Sets.newHashSet("S3649"); + CsRules.ruleKeys = Set.of("S3649"); CsRules.returnRepository = true; CSharpSonarWayProfile profileDef = new CSharpSonarWayProfile(); @@ -102,7 +102,7 @@ void sonar_security_with_duplicated_quality_profile_name() { NewBuiltInQualityProfile sonarWay = context.createBuiltInQualityProfile("Sonar way", CSharpPlugin.LANGUAGE_KEY); sonarWay.activateRule(CSharpPlugin.REPOSITORY_KEY, "S1"); sonarWay.done(); - CsRules.ruleKeys = Sets.newHashSet("S2"); + CsRules.ruleKeys = Set.of("S2"); CSharpSonarWayProfile profileDef = new CSharpSonarWayProfile(); @@ -126,7 +126,7 @@ void sonar_security_missing() { @Test void sonar_security_7_3_present() { Context context = new Context(); - CsRules.ruleKeys = Sets.newHashSet("S3649"); + CsRules.ruleKeys = Set.of("S3649"); CsRules.returnRepository = false; CSharpSonarWayProfile profileDef = new CSharpSonarWayProfile(); diff --git a/sonar-dotnet-shared-library/pom.xml b/sonar-dotnet-shared-library/pom.xml index 0fd0748c201..8ce9ca9e0e3 100644 --- a/sonar-dotnet-shared-library/pom.xml +++ b/sonar-dotnet-shared-library/pom.xml @@ -83,10 +83,6 @@ org.mockito mockito-core - - com.google.guava - guava - org.sonarsource.sonarqube sonar-plugin-api-impl diff --git a/sonar-dotnet-shared-library/src/main/java/org/sonarsource/dotnet/shared/PropertyUtils.java b/sonar-dotnet-shared-library/src/main/java/org/sonarsource/dotnet/shared/PropertyUtils.java new file mode 100644 index 00000000000..5ee7f1a9cf2 --- /dev/null +++ b/sonar-dotnet-shared-library/src/main/java/org/sonarsource/dotnet/shared/PropertyUtils.java @@ -0,0 +1,44 @@ +/* + * SonarSource :: .NET :: Shared library + * Copyright (C) 2014-2024 SonarSource SA + * mailto:info AT sonarsource DOT com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +package org.sonarsource.dotnet.shared; + +import org.sonar.api.config.PropertyDefinition; + +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + +public class PropertyUtils { + private PropertyUtils() { } + + public static Set nonProperties(List extensions) { + return extensions.stream() + .filter(extension -> !(extension instanceof PropertyDefinition)) + .collect(Collectors.toSet()); + } + + public static Set propertyKeys(List extensions) { + return extensions.stream() + .filter(PropertyDefinition.class::isInstance) + .map(extension -> ((PropertyDefinition) extension).key()) + .collect(Collectors.toSet()); + } +} diff --git a/sonar-dotnet-shared-library/src/test/java/org/sonar/plugins/dotnet/tests/CoverageReportImportSensorTest.java b/sonar-dotnet-shared-library/src/test/java/org/sonar/plugins/dotnet/tests/CoverageReportImportSensorTest.java index db5c653f806..de9c9e4a943 100644 --- a/sonar-dotnet-shared-library/src/test/java/org/sonar/plugins/dotnet/tests/CoverageReportImportSensorTest.java +++ b/sonar-dotnet-shared-library/src/test/java/org/sonar/plugins/dotnet/tests/CoverageReportImportSensorTest.java @@ -19,12 +19,12 @@ */ package org.sonar.plugins.dotnet.tests; -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableMap; import java.io.File; import java.io.IOException; import java.util.Collections; import java.util.HashSet; +import java.util.List; +import java.util.Map; import java.util.function.Predicate; import org.junit.Before; import org.junit.Rule; @@ -247,20 +247,14 @@ private SensorContextTester computeCoverageMeasures(boolean isIntegrationTest) { String bazPath = new File(baseDir, "Baz.java").getAbsolutePath(); String barPath = new File(baseDir, "Bar.cs").getAbsolutePath(); when(coverage.files()).thenReturn(new HashSet<>(asList(fooPath, barPath, bazPath))); - when(coverage.hits(fooPath)).thenReturn(ImmutableMap.builder() - .put(2, 1) - .put(4, 0) - .build()); - when(coverage.hits(barPath)).thenReturn(ImmutableMap.builder() - .put(42, 1) - .build()); - when(coverage.hits(bazPath)).thenReturn(ImmutableMap.builder() - .put(42, 1) - .build()); - when(coverage.getBranchCoverage(fooPath)).thenReturn(ImmutableList.builder() - .add(new BranchCoverage(5, 2, 1)) - .add(new BranchCoverage(6, 3, 2)) - .build()); + when(coverage.hits(fooPath)).thenReturn(Map.of( + 2, 1, + 4, 0)); + when(coverage.hits(barPath)).thenReturn(Map.of(42, 1)); + when(coverage.hits(bazPath)).thenReturn(Map.of(42, 1)); + when(coverage.getBranchCoverage(fooPath)).thenReturn(List.of( + new BranchCoverage(5, 2, 1), + new BranchCoverage(6, 3, 2))); DefaultInputFile inputFile = new TestInputFileBuilder("foo", baseDir, new File(baseDir, "Foo.cs")) .setLanguage("cs") diff --git a/sonar-dotnet-shared-library/src/test/java/org/sonar/plugins/dotnet/tests/CoverageTest.java b/sonar-dotnet-shared-library/src/test/java/org/sonar/plugins/dotnet/tests/CoverageTest.java index dfccec072bb..348868a5e7f 100644 --- a/sonar-dotnet-shared-library/src/test/java/org/sonar/plugins/dotnet/tests/CoverageTest.java +++ b/sonar-dotnet-shared-library/src/test/java/org/sonar/plugins/dotnet/tests/CoverageTest.java @@ -19,7 +19,7 @@ */ package org.sonar.plugins.dotnet.tests; -import com.google.common.collect.ImmutableMap; +import java.util.Map; import org.junit.Test; import static org.assertj.core.api.Assertions.assertThat; @@ -34,39 +34,39 @@ public void test() { coverage.addHits("foo.txt", 42, 1); assertThat(coverage.files()).containsExactlyInAnyOrder("foo.txt"); - assertThat(coverage.hits("foo.txt")).isEqualTo(ImmutableMap.of(42, 1)); + assertThat(coverage.hits("foo.txt")).isEqualTo(Map.of(42, 1)); coverage.addHits("foo.txt", 42, 3); assertThat(coverage.files()).containsExactlyInAnyOrder("foo.txt"); - assertThat(coverage.hits("foo.txt")).isEqualTo(ImmutableMap.of(42, 4)); + assertThat(coverage.hits("foo.txt")).isEqualTo(Map.of(42, 4)); coverage.addHits("foo.txt", 1234, 11); assertThat(coverage.files()).containsExactlyInAnyOrder("foo.txt"); - assertThat(coverage.hits("foo.txt")).isEqualTo(ImmutableMap.of(42, 4, 1234, 11)); + assertThat(coverage.hits("foo.txt")).isEqualTo(Map.of(42, 4, 1234, 11)); coverage.addHits("bar.txt", 1, 2); assertThat(coverage.files()).containsExactlyInAnyOrder("foo.txt", "bar.txt"); - assertThat(coverage.hits("foo.txt")).isEqualTo(ImmutableMap.of(42, 4, 1234, 11)); - assertThat(coverage.hits("bar.txt")).isEqualTo(ImmutableMap.of(1, 2)); + assertThat(coverage.hits("foo.txt")).isEqualTo(Map.of(42, 4, 1234, 11)); + assertThat(coverage.hits("bar.txt")).isEqualTo(Map.of(1, 2)); Coverage other = new Coverage(); coverage.mergeWith(other); assertThat(coverage.files()).containsExactlyInAnyOrder("foo.txt", "bar.txt"); - assertThat(coverage.hits("foo.txt")).isEqualTo(ImmutableMap.of(42, 4, 1234, 11)); - assertThat(coverage.hits("bar.txt")).isEqualTo(ImmutableMap.of(1, 2)); + assertThat(coverage.hits("foo.txt")).isEqualTo(Map.of(42, 4, 1234, 11)); + assertThat(coverage.hits("bar.txt")).isEqualTo(Map.of(1, 2)); other.addHits("baz.txt", 2, 7); assertThat(other.files()).containsExactlyInAnyOrder("baz.txt"); - assertThat(other.hits("baz.txt")).isEqualTo(ImmutableMap.of(2, 7)); + assertThat(other.hits("baz.txt")).isEqualTo(Map.of(2, 7)); coverage.mergeWith(other); assertThat(other.files()).containsExactlyInAnyOrder("baz.txt"); - assertThat(other.hits("baz.txt")).isEqualTo(ImmutableMap.of(2, 7)); + assertThat(other.hits("baz.txt")).isEqualTo(Map.of(2, 7)); assertThat(coverage.files()).containsExactlyInAnyOrder("foo.txt", "bar.txt", "baz.txt"); - assertThat(coverage.hits("foo.txt")).isEqualTo(ImmutableMap.of(42, 4, 1234, 11)); - assertThat(coverage.hits("bar.txt")).isEqualTo(ImmutableMap.of(1, 2)); - assertThat(coverage.hits("baz.txt")).isEqualTo(ImmutableMap.of(2, 7)); + assertThat(coverage.hits("foo.txt")).isEqualTo(Map.of(42, 4, 1234, 11)); + assertThat(coverage.hits("bar.txt")).isEqualTo(Map.of(1, 2)); + assertThat(coverage.hits("baz.txt")).isEqualTo(Map.of(2, 7)); } @Test diff --git a/sonar-dotnet-shared-library/src/test/java/org/sonar/plugins/dotnet/tests/WildcardPatternFileProviderTest.java b/sonar-dotnet-shared-library/src/test/java/org/sonar/plugins/dotnet/tests/WildcardPatternFileProviderTest.java index 5ee6a862405..a34834bbec1 100644 --- a/sonar-dotnet-shared-library/src/test/java/org/sonar/plugins/dotnet/tests/WildcardPatternFileProviderTest.java +++ b/sonar-dotnet-shared-library/src/test/java/org/sonar/plugins/dotnet/tests/WildcardPatternFileProviderTest.java @@ -19,7 +19,6 @@ */ package org.sonar.plugins.dotnet.tests; -import com.google.common.base.Joiner; import java.io.File; import java.util.List; import java.util.Set; @@ -249,7 +248,7 @@ public void given_pattern_with_mixed_folder_separator_listFiles_supports_pattern } private static String path(String... elements) { - return Joiner.on(File.separator).join(elements); + return String.join(File.separator, elements); } private static Set listFiles(String pattern) { diff --git a/sonar-dotnet-shared-library/src/test/java/org/sonarsource/dotnet/shared/plugins/CodeCoverageProviderTest.java b/sonar-dotnet-shared-library/src/test/java/org/sonarsource/dotnet/shared/plugins/CodeCoverageProviderTest.java index 1c707f1c111..86612fecb1c 100644 --- a/sonar-dotnet-shared-library/src/test/java/org/sonarsource/dotnet/shared/plugins/CodeCoverageProviderTest.java +++ b/sonar-dotnet-shared-library/src/test/java/org/sonarsource/dotnet/shared/plugins/CodeCoverageProviderTest.java @@ -19,18 +19,16 @@ */ package org.sonarsource.dotnet.shared.plugins; -import com.google.common.collect.ImmutableSet; -import java.util.List; -import java.util.Set; import org.junit.Test; import org.sonar.api.batch.sensor.SensorDescriptor; -import org.sonar.api.config.PropertyDefinition; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import static org.sonarsource.dotnet.shared.PropertyUtils.nonProperties; +import static org.sonarsource.dotnet.shared.PropertyUtils.propertyKeys; public class CodeCoverageProviderTest { @@ -113,25 +111,4 @@ private static CodeCoverageProvider createTestProvider() { return new CodeCoverageProvider(pluginMetadata); } - private static Set nonProperties(List extensions) { - ImmutableSet.Builder builder = ImmutableSet.builder(); - for (Object extension : extensions) { - if (!(extension instanceof PropertyDefinition)) { - builder.add(extension); - } - } - return builder.build(); - } - - private static Set propertyKeys(List extensions) { - ImmutableSet.Builder builder = ImmutableSet.builder(); - for (Object extension : extensions) { - if (extension instanceof PropertyDefinition) { - PropertyDefinition property = (PropertyDefinition) extension; - builder.add(property.key()); - } - } - return builder.build(); - } - } diff --git a/sonar-dotnet-shared-library/src/test/java/org/sonarsource/dotnet/shared/plugins/RoslynProfileExporterTest.java b/sonar-dotnet-shared-library/src/test/java/org/sonarsource/dotnet/shared/plugins/RoslynProfileExporterTest.java index 3e5c4203e7a..a813686f7ad 100644 --- a/sonar-dotnet-shared-library/src/test/java/org/sonarsource/dotnet/shared/plugins/RoslynProfileExporterTest.java +++ b/sonar-dotnet-shared-library/src/test/java/org/sonarsource/dotnet/shared/plugins/RoslynProfileExporterTest.java @@ -19,11 +19,11 @@ */ package org.sonarsource.dotnet.shared.plugins; -import com.google.common.io.Files; -import java.io.File; import java.io.IOException; import java.io.StringWriter; import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -79,7 +79,7 @@ public void no_rules() throws Exception { exporter.exportProfile(mock(RulesProfile.class), writer); String actual = writer.toString().replaceAll("\r?\n|\r", ""); - String expected = Files.toString(new File("src/test/resources/RoslynProfileExporterTest/no_rules.xml"), StandardCharsets.UTF_8).replaceAll("\r?\n|\r", ""); + String expected = Files.readString(Path.of("src/test/resources/RoslynProfileExporterTest/no_rules.xml"), StandardCharsets.UTF_8).replaceAll("\r?\n|\r", ""); assertThat(actual).isEqualTo(expected); } @@ -139,7 +139,7 @@ public void only_sonarlint() throws Exception { exporter.exportProfile(rulesProfile, writer); String actual = writer.toString().replaceAll("\r?\n|\r", ""); - String expected = Files.toString(new File("src/test/resources/RoslynProfileExporterTest/only_sonarlint.xml"), StandardCharsets.UTF_8).replaceAll("\r?\n|\r", ""); + String expected = Files.readString(Path.of("src/test/resources/RoslynProfileExporterTest/only_sonarlint.xml"), StandardCharsets.UTF_8).replaceAll("\r?\n|\r", ""); assertThat(actual).isEqualTo(expected); } @@ -221,7 +221,7 @@ public void mixed_sonarlint_and_custom_rules() throws Exception { exporter.exportProfile(rulesProfile, writer); String actual = writer.toString().replaceAll("\r?\n|\r", ""); - String expected = Files.toString(new File("src/test/resources/RoslynProfileExporterTest/mixed.xml"), StandardCharsets.UTF_8).replaceAll("\r?\n|\r", ""); + String expected = Files.readString(Path.of("src/test/resources/RoslynProfileExporterTest/mixed.xml"), StandardCharsets.UTF_8).replaceAll("\r?\n|\r", ""); assertThat(actual).isEqualTo(expected); } @@ -289,7 +289,7 @@ public void ruleWithParameterWithNullValue() throws IOException { exporter.exportProfile(rulesProfile, writer); String actual = writer.toString().replaceAll("\r?\n|\r", ""); - String expected = Files.toString(new File("src/test/resources/RoslynProfileExporterTest/empty_string_value.xml"), StandardCharsets.UTF_8).replaceAll("\r?\n|\r", ""); + String expected = Files.readString(Path.of("src/test/resources/RoslynProfileExporterTest/empty_string_value.xml"), StandardCharsets.UTF_8).replaceAll("\r?\n|\r", ""); assertThat(actual).isEqualTo(expected); } diff --git a/sonar-dotnet-shared-library/src/test/java/org/sonarsource/dotnet/shared/plugins/UnitTestResultsProviderTest.java b/sonar-dotnet-shared-library/src/test/java/org/sonarsource/dotnet/shared/plugins/UnitTestResultsProviderTest.java index 847a4667fac..3f128e0ed54 100644 --- a/sonar-dotnet-shared-library/src/test/java/org/sonarsource/dotnet/shared/plugins/UnitTestResultsProviderTest.java +++ b/sonar-dotnet-shared-library/src/test/java/org/sonarsource/dotnet/shared/plugins/UnitTestResultsProviderTest.java @@ -19,16 +19,16 @@ */ package org.sonarsource.dotnet.shared.plugins; -import com.google.common.collect.ImmutableSet; import java.util.List; -import java.util.Set; + import org.junit.Test; -import org.sonar.api.config.PropertyDefinition; import org.sonar.plugins.dotnet.tests.UnitTestResultsImportSensor; import static org.assertj.core.api.Assertions.assertThat; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; +import static org.sonarsource.dotnet.shared.PropertyUtils.nonProperties; +import static org.sonarsource.dotnet.shared.PropertyUtils.propertyKeys; public class UnitTestResultsProviderTest { @@ -62,25 +62,4 @@ public void csharp() { "sonar.cs.nunit.reportsPaths"); } - private static Set nonProperties(List extensions) { - ImmutableSet.Builder builder = ImmutableSet.builder(); - for (Object extension : extensions) { - if (!(extension instanceof PropertyDefinition)) { - builder.add(extension); - } - } - return builder.build(); - } - - private static Set propertyKeys(List extensions) { - ImmutableSet.Builder builder = ImmutableSet.builder(); - for (Object extension : extensions) { - if (extension instanceof PropertyDefinition) { - PropertyDefinition property = (PropertyDefinition) extension; - builder.add(property.key()); - } - } - return builder.build(); - } - } diff --git a/sonar-vbnet-plugin/pom.xml b/sonar-vbnet-plugin/pom.xml index fbe7d13ae98..544c139d319 100644 --- a/sonar-vbnet-plugin/pom.xml +++ b/sonar-vbnet-plugin/pom.xml @@ -90,10 +90,6 @@ org.mockito mockito-core - - com.google.guava - guava - org.codehaus.woodstox stax2-api diff --git a/sonar-vbnet-plugin/src/test/java/org/sonar/plugins/vbnet/VbNetPluginTest.java b/sonar-vbnet-plugin/src/test/java/org/sonar/plugins/vbnet/VbNetPluginTest.java index 6a2fe3300e5..9f41e522c6f 100644 --- a/sonar-vbnet-plugin/src/test/java/org/sonar/plugins/vbnet/VbNetPluginTest.java +++ b/sonar-vbnet-plugin/src/test/java/org/sonar/plugins/vbnet/VbNetPluginTest.java @@ -19,7 +19,6 @@ */ package org.sonar.plugins.vbnet; -import com.google.common.collect.ImmutableList; import java.util.List; import org.junit.jupiter.api.Test; @@ -27,7 +26,6 @@ import org.sonar.api.SonarEdition; import org.sonar.api.SonarQubeSide; import org.sonar.api.SonarRuntime; -import org.sonar.api.config.PropertyDefinition; import org.sonar.api.internal.SonarRuntimeImpl; import org.sonar.api.utils.Version; import org.sonarsource.dotnet.shared.plugins.CodeCoverageProvider; @@ -48,6 +46,7 @@ import org.sonarsource.dotnet.shared.plugins.WrongEncodingFileFilter; import static org.assertj.core.api.Assertions.assertThat; +import static org.sonarsource.dotnet.shared.PropertyUtils.nonProperties; class VbNetPluginTest { @@ -95,14 +94,4 @@ void getExtensions() { + new VbNetPropertyDefinitions(sonarRuntime).create().size()); } - private static List nonProperties(List extensions) { - ImmutableList.Builder builder = ImmutableList.builder(); - for (Object extension : extensions) { - if (!(extension instanceof PropertyDefinition)) { - builder.add(extension); - } - } - return builder.build(); - } - }