diff --git a/src/main/java/org/jenkinsci/plugins/prometheus/DiskUsageCollector.java b/src/main/java/org/jenkinsci/plugins/prometheus/DiskUsageCollector.java index c7222f2f8..7e2adb7d6 100644 --- a/src/main/java/org/jenkinsci/plugins/prometheus/DiskUsageCollector.java +++ b/src/main/java/org/jenkinsci/plugins/prometheus/DiskUsageCollector.java @@ -17,7 +17,13 @@ import java.io.IOException; import java.nio.file.FileStore; import java.nio.file.Files; -import java.util.*; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Optional; +import java.util.Set; import java.util.stream.Collectors; import java.util.stream.Stream; diff --git a/src/main/java/org/jenkinsci/plugins/prometheus/collectors/builds/StageSummary.java b/src/main/java/org/jenkinsci/plugins/prometheus/collectors/builds/StageSummary.java index 18f1679e6..f4c44caf2 100644 --- a/src/main/java/org/jenkinsci/plugins/prometheus/collectors/builds/StageSummary.java +++ b/src/main/java/org/jenkinsci/plugins/prometheus/collectors/builds/StageSummary.java @@ -13,7 +13,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.IOException; import java.util.List; import static org.jenkinsci.plugins.prometheus.util.FlowNodes.getSortedStageNodes; diff --git a/src/main/java/org/jenkinsci/plugins/prometheus/collectors/disk/DiskCollectorFactory.java b/src/main/java/org/jenkinsci/plugins/prometheus/collectors/disk/DiskCollectorFactory.java index c26a5c7cd..d247c4428 100644 --- a/src/main/java/org/jenkinsci/plugins/prometheus/collectors/disk/DiskCollectorFactory.java +++ b/src/main/java/org/jenkinsci/plugins/prometheus/collectors/disk/DiskCollectorFactory.java @@ -11,7 +11,9 @@ import java.nio.file.FileStore; import java.util.Objects; -import static org.jenkinsci.plugins.prometheus.collectors.CollectorType.*; +import static org.jenkinsci.plugins.prometheus.collectors.CollectorType.DISK_USAGE_BYTES_GAUGE; +import static org.jenkinsci.plugins.prometheus.collectors.CollectorType.DISK_USAGE_FILE_COUNT_GAUGE; +import static org.jenkinsci.plugins.prometheus.collectors.CollectorType.JOB_USAGE_BYTES_GAUGE; public class DiskCollectorFactory extends BaseCollectorFactory { diff --git a/src/main/java/org/jenkinsci/plugins/prometheus/config/PrometheusConfiguration.java b/src/main/java/org/jenkinsci/plugins/prometheus/config/PrometheusConfiguration.java index f9efe8027..6303d4925 100644 --- a/src/main/java/org/jenkinsci/plugins/prometheus/config/PrometheusConfiguration.java +++ b/src/main/java/org/jenkinsci/plugins/prometheus/config/PrometheusConfiguration.java @@ -1,5 +1,6 @@ package org.jenkinsci.plugins.prometheus.config; +import edu.umd.cs.findbugs.annotations.CheckForNull; import hudson.Extension; import hudson.util.FormValidation; import jenkins.YesNoMaybe; @@ -14,7 +15,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import edu.umd.cs.findbugs.annotations.CheckForNull; import java.util.Arrays; import java.util.List; import java.util.Map; diff --git a/src/main/java/org/jenkinsci/plugins/prometheus/rest/PrometheusAction.java b/src/main/java/org/jenkinsci/plugins/prometheus/rest/PrometheusAction.java index 68d5f22dd..f44ece243 100644 --- a/src/main/java/org/jenkinsci/plugins/prometheus/rest/PrometheusAction.java +++ b/src/main/java/org/jenkinsci/plugins/prometheus/rest/PrometheusAction.java @@ -14,9 +14,6 @@ import org.kohsuke.stapler.StaplerResponse2; import java.io.IOException; -import java.io.OutputStreamWriter; -import java.io.Writer; -import java.nio.charset.StandardCharsets; @Extension public class PrometheusAction implements UnprotectedRootAction { diff --git a/src/test/java/org/jenkinsci/plugins/prometheus/CodeCoverageCollectorTest.java b/src/test/java/org/jenkinsci/plugins/prometheus/CodeCoverageCollectorTest.java index 041d7fed9..70780649c 100644 --- a/src/test/java/org/jenkinsci/plugins/prometheus/CodeCoverageCollectorTest.java +++ b/src/test/java/org/jenkinsci/plugins/prometheus/CodeCoverageCollectorTest.java @@ -17,7 +17,9 @@ import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) diff --git a/src/test/java/org/jenkinsci/plugins/prometheus/DiskUsageCollectorTest.java b/src/test/java/org/jenkinsci/plugins/prometheus/DiskUsageCollectorTest.java index 6a55fc521..c3eb4f30f 100644 --- a/src/test/java/org/jenkinsci/plugins/prometheus/DiskUsageCollectorTest.java +++ b/src/test/java/org/jenkinsci/plugins/prometheus/DiskUsageCollectorTest.java @@ -30,9 +30,16 @@ import static java.util.Objects.requireNonNull; import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.Matchers.*; +import static org.hamcrest.Matchers.containsInAnyOrder; +import static org.hamcrest.Matchers.empty; +import static org.hamcrest.Matchers.equalTo; +import static org.hamcrest.Matchers.is; import static org.mockito.BDDMockito.given; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.RETURNS_DEEP_STUBS; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.when; +import static org.mockito.Mockito.withSettings; @ExtendWith(MockitoExtension.class) public class DiskUsageCollectorTest { diff --git a/src/test/java/org/jenkinsci/plugins/prometheus/JenkinsStatusCollectorTest.java b/src/test/java/org/jenkinsci/plugins/prometheus/JenkinsStatusCollectorTest.java index 949f05fb3..0205fad41 100644 --- a/src/test/java/org/jenkinsci/plugins/prometheus/JenkinsStatusCollectorTest.java +++ b/src/test/java/org/jenkinsci/plugins/prometheus/JenkinsStatusCollectorTest.java @@ -11,7 +11,9 @@ import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) public class JenkinsStatusCollectorTest { diff --git a/src/test/java/org/jenkinsci/plugins/prometheus/collectors/TestBasedMetricCollectorTest.java b/src/test/java/org/jenkinsci/plugins/prometheus/collectors/TestBasedMetricCollectorTest.java index 34546149a..8d727fc90 100644 --- a/src/test/java/org/jenkinsci/plugins/prometheus/collectors/TestBasedMetricCollectorTest.java +++ b/src/test/java/org/jenkinsci/plugins/prometheus/collectors/TestBasedMetricCollectorTest.java @@ -9,7 +9,9 @@ import org.junit.jupiter.api.Test; import org.mockito.MockedStatic; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.when; public class TestBasedMetricCollectorTest extends MockedRunCollectorTest { diff --git a/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/BuildLikelyStuckGaugeTest.java b/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/BuildLikelyStuckGaugeTest.java index fbef6d78c..1fc2a9c57 100644 --- a/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/BuildLikelyStuckGaugeTest.java +++ b/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/BuildLikelyStuckGaugeTest.java @@ -5,7 +5,6 @@ import org.jenkinsci.plugins.prometheus.collectors.testutils.MockedRunCollectorTest; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import org.mockito.Mockito; import java.util.List; diff --git a/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/BuildLogFileSizeGaugeTest.java b/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/BuildLogFileSizeGaugeTest.java index a60627836..2ae5a0c2e 100644 --- a/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/BuildLogFileSizeGaugeTest.java +++ b/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/BuildLogFileSizeGaugeTest.java @@ -3,7 +3,6 @@ import hudson.console.AnnotatedLargeText; import io.prometheus.client.Collector; import org.jenkinsci.plugins.prometheus.collectors.testutils.MockedRunCollectorTest; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; import org.mockito.Mockito; @@ -11,7 +10,7 @@ import java.util.List; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) diff --git a/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/CounterManagerTest.java b/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/CounterManagerTest.java index 669a07d56..04c2a191d 100644 --- a/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/CounterManagerTest.java +++ b/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/CounterManagerTest.java @@ -9,7 +9,9 @@ import java.util.Arrays; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.when; public class CounterManagerTest extends MockedRunCollectorTest { private final CounterManager manager; diff --git a/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/FailedTestsGaugeTest.java b/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/FailedTestsGaugeTest.java index 28468141e..4d80f46ad 100644 --- a/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/FailedTestsGaugeTest.java +++ b/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/FailedTestsGaugeTest.java @@ -10,7 +10,9 @@ import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.when; @SuppressWarnings("rawtypes") public class FailedTestsGaugeTest extends MockedRunCollectorTest { diff --git a/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/SkippedTestsGaugeTest.java b/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/SkippedTestsGaugeTest.java index 0fa2f592e..26478a5d8 100644 --- a/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/SkippedTestsGaugeTest.java +++ b/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/SkippedTestsGaugeTest.java @@ -10,7 +10,9 @@ import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.when; @SuppressWarnings("rawtypes") public class SkippedTestsGaugeTest extends MockedRunCollectorTest { diff --git a/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/TotalTestsGaugeTest.java b/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/TotalTestsGaugeTest.java index 50531059b..38769f079 100644 --- a/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/TotalTestsGaugeTest.java +++ b/src/test/java/org/jenkinsci/plugins/prometheus/collectors/builds/TotalTestsGaugeTest.java @@ -10,7 +10,9 @@ import java.util.List; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.when; @SuppressWarnings("rawtypes") public class TotalTestsGaugeTest extends MockedRunCollectorTest { diff --git a/src/test/java/org/jenkinsci/plugins/prometheus/collectors/disk/DiskUsageBytesGaugeTest.java b/src/test/java/org/jenkinsci/plugins/prometheus/collectors/disk/DiskUsageBytesGaugeTest.java index b2362433d..fe2b8b08e 100644 --- a/src/test/java/org/jenkinsci/plugins/prometheus/collectors/disk/DiskUsageBytesGaugeTest.java +++ b/src/test/java/org/jenkinsci/plugins/prometheus/collectors/disk/DiskUsageBytesGaugeTest.java @@ -10,7 +10,6 @@ import java.util.List; -import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) diff --git a/src/test/java/org/jenkinsci/plugins/prometheus/collectors/disk/JobUsageBytesGaugeTest.java b/src/test/java/org/jenkinsci/plugins/prometheus/collectors/disk/JobUsageBytesGaugeTest.java index 08b994e43..1dd39839a 100644 --- a/src/test/java/org/jenkinsci/plugins/prometheus/collectors/disk/JobUsageBytesGaugeTest.java +++ b/src/test/java/org/jenkinsci/plugins/prometheus/collectors/disk/JobUsageBytesGaugeTest.java @@ -1,6 +1,5 @@ package org.jenkinsci.plugins.prometheus.collectors.disk; -import com.cloudbees.simplediskusage.DiskItem; import com.cloudbees.simplediskusage.JobDiskItem; import io.prometheus.client.Collector; import org.jenkinsci.plugins.prometheus.collectors.testutils.CollectorTest; diff --git a/src/test/java/org/jenkinsci/plugins/prometheus/config/PrometheusConfigurationTest.java b/src/test/java/org/jenkinsci/plugins/prometheus/config/PrometheusConfigurationTest.java index bb44cbad2..931bbf2f0 100644 --- a/src/test/java/org/jenkinsci/plugins/prometheus/config/PrometheusConfigurationTest.java +++ b/src/test/java/org/jenkinsci/plugins/prometheus/config/PrometheusConfigurationTest.java @@ -11,11 +11,14 @@ import java.util.Arrays; import java.util.List; -import java.util.Locale; import static com.github.stefanbirkner.systemlambda.SystemLambda.withEnvironmentVariable; -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.ArgumentMatchers.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyBoolean; +import static org.mockito.ArgumentMatchers.anyLong; @SuppressWarnings("rawtypes") public class PrometheusConfigurationTest { diff --git a/src/test/java/org/jenkinsci/plugins/prometheus/config/disabledmetrics/MetricStatusCheckerTest.java b/src/test/java/org/jenkinsci/plugins/prometheus/config/disabledmetrics/MetricStatusCheckerTest.java index bc10896bb..23e144838 100644 --- a/src/test/java/org/jenkinsci/plugins/prometheus/config/disabledmetrics/MetricStatusCheckerTest.java +++ b/src/test/java/org/jenkinsci/plugins/prometheus/config/disabledmetrics/MetricStatusCheckerTest.java @@ -11,7 +11,9 @@ import java.util.List; import java.util.Set; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.when; public class MetricStatusCheckerTest { diff --git a/src/test/java/org/jenkinsci/plugins/prometheus/rest/PrometheusActionTest.java b/src/test/java/org/jenkinsci/plugins/prometheus/rest/PrometheusActionTest.java index 5e058f349..bea1c15d6 100644 --- a/src/test/java/org/jenkinsci/plugins/prometheus/rest/PrometheusActionTest.java +++ b/src/test/java/org/jenkinsci/plugins/prometheus/rest/PrometheusActionTest.java @@ -10,7 +10,9 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; -import org.kohsuke.stapler.*; +import org.kohsuke.stapler.HttpResponse; +import org.kohsuke.stapler.StaplerRequest2; +import org.kohsuke.stapler.StaplerResponse2; import org.mockito.Mock; import org.mockito.MockedStatic; import org.mockito.junit.jupiter.MockitoExtension; diff --git a/src/test/java/org/jenkinsci/plugins/prometheus/util/ConfigurationUtilsTest.java b/src/test/java/org/jenkinsci/plugins/prometheus/util/ConfigurationUtilsTest.java index 009d56896..5a37121fa 100644 --- a/src/test/java/org/jenkinsci/plugins/prometheus/util/ConfigurationUtilsTest.java +++ b/src/test/java/org/jenkinsci/plugins/prometheus/util/ConfigurationUtilsTest.java @@ -8,7 +8,9 @@ import static com.github.stefanbirkner.systemlambda.SystemLambda.withEnvironmentVariable; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.when; public class ConfigurationUtilsTest { diff --git a/src/test/java/org/jenkinsci/plugins/prometheus/util/JobsTest.java b/src/test/java/org/jenkinsci/plugins/prometheus/util/JobsTest.java index 57266914c..1a025d9b8 100644 --- a/src/test/java/org/jenkinsci/plugins/prometheus/util/JobsTest.java +++ b/src/test/java/org/jenkinsci/plugins/prometheus/util/JobsTest.java @@ -9,7 +9,9 @@ import java.util.ArrayList; import java.util.List; -import static org.mockito.Mockito.*; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.when; @SuppressWarnings("rawtypes") public class JobsTest { diff --git a/src/test/java/org/jenkinsci/plugins/prometheus/util/RunsTest.java b/src/test/java/org/jenkinsci/plugins/prometheus/util/RunsTest.java index 481a4b830..aedb09936 100644 --- a/src/test/java/org/jenkinsci/plugins/prometheus/util/RunsTest.java +++ b/src/test/java/org/jenkinsci/plugins/prometheus/util/RunsTest.java @@ -18,8 +18,12 @@ import java.util.Map; import java.util.stream.Stream; -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.Mockito.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.mockStatic; +import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) public class RunsTest {