From: danielhanrahan Date: Thu, 4 Dec 2025 20:08:26 +0000 (+0000) Subject: Fix Sonar issues for policy-common X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=29431b175d547d4f4da302c535f76366c7af0cea;p=policy%2Fclamp.git Fix Sonar issues for policy-common Issue-ID: POLICY-5423 Change-Id: I8b1a6dc9cd52d2cde8958531b3ecc6a3d2f7249f Signed-off-by: danielhanrahan --- diff --git a/policy-common/src/test/java/org/onap/policy/common/endpoints/listeners/JsonListenerTest.java b/policy-common/src/test/java/org/onap/policy/common/endpoints/listeners/JsonListenerTest.java index c2e5f90d5..8070ffa89 100644 --- a/policy-common/src/test/java/org/onap/policy/common/endpoints/listeners/JsonListenerTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/endpoints/listeners/JsonListenerTest.java @@ -64,7 +64,7 @@ class JsonListenerTest { * Initializes statics. */ @BeforeAll - public static void setUpBeforeClass() { + static void setUpBeforeClass() { saveLevel = logger.getLevel(); logger.setLevel(Level.INFO); @@ -73,7 +73,7 @@ class JsonListenerTest { } @AfterAll - public static void tearDownAfterClass() { + static void tearDownAfterClass() { logger.setLevel(saveLevel); appender.stop(); } @@ -82,7 +82,7 @@ class JsonListenerTest { * Initializes mocks and a listener. */ @BeforeEach - public void setUp() { + void setUp() { appender.clearExtractions(); primary = new JsonListener() { @@ -94,7 +94,7 @@ class JsonListenerTest { } @AfterEach - public void tearDown() { + void tearDown() { logger.detachAppender(appender); } diff --git a/policy-common/src/test/java/org/onap/policy/common/endpoints/listeners/MessageTypeDispatcherTest.java b/policy-common/src/test/java/org/onap/policy/common/endpoints/listeners/MessageTypeDispatcherTest.java index e0184bd12..a132c4503 100644 --- a/policy-common/src/test/java/org/onap/policy/common/endpoints/listeners/MessageTypeDispatcherTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/endpoints/listeners/MessageTypeDispatcherTest.java @@ -70,7 +70,7 @@ class MessageTypeDispatcherTest { * Initializes statics. */ @BeforeAll - public static void setUpBeforeClass() { + static void setUpBeforeClass() { saveLevel = logger.getLevel(); logger.setLevel(Level.INFO); @@ -79,7 +79,7 @@ class MessageTypeDispatcherTest { } @AfterAll - public static void tearDownAfterClass() { + static void tearDownAfterClass() { logger.setLevel(saveLevel); appender.stop(); } @@ -89,7 +89,7 @@ class MessageTypeDispatcherTest { */ @BeforeEach @SuppressWarnings("unchecked") - public void setUp() { + void setUp() { appender.clearExtractions(); secondary1 = mock(ScoListener.class); @@ -99,7 +99,7 @@ class MessageTypeDispatcherTest { } @AfterEach - public void tearDown() { + void tearDown() { logger.detachAppender(appender); } diff --git a/policy-common/src/test/java/org/onap/policy/common/endpoints/listeners/ScoListenerTest.java b/policy-common/src/test/java/org/onap/policy/common/endpoints/listeners/ScoListenerTest.java index cb8fb70d6..fd7f0c05e 100644 --- a/policy-common/src/test/java/org/onap/policy/common/endpoints/listeners/ScoListenerTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/endpoints/listeners/ScoListenerTest.java @@ -67,7 +67,7 @@ class ScoListenerTest { * Initializes statics. */ @BeforeAll - public static void setUpBeforeClass() { + static void setUpBeforeClass() { saveLevel = logger.getLevel(); logger.setLevel(Level.INFO); @@ -76,7 +76,7 @@ class ScoListenerTest { } @AfterAll - public static void tearDownAfterClass() { + static void tearDownAfterClass() { logger.setLevel(saveLevel); appender.stop(); } @@ -85,7 +85,7 @@ class ScoListenerTest { * Create various mocks and primary handler. */ @BeforeEach - public void setUp() { + void setUp() { appender.clearExtractions(); primary = new ScoListener(MyMessage.class) { @@ -98,7 +98,7 @@ class ScoListenerTest { } @AfterEach - public void tearDown() { + void tearDown() { logger.detachAppender(appender); } diff --git a/policy-common/src/test/java/org/onap/policy/common/gson/JacksonExclusionStrategyTest.java b/policy-common/src/test/java/org/onap/policy/common/gson/JacksonExclusionStrategyTest.java index fc3c6675e..bc14e4588 100644 --- a/policy-common/src/test/java/org/onap/policy/common/gson/JacksonExclusionStrategyTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/gson/JacksonExclusionStrategyTest.java @@ -45,7 +45,7 @@ class JacksonExclusionStrategyTest { private static Gson gson; @BeforeAll - public static void setUpBeforeClass() { + static void setUpBeforeClass() { strategy = new JacksonExclusionStrategy(); gson = new GsonBuilder().setExclusionStrategies(strategy).create(); } diff --git a/policy-common/src/test/java/org/onap/policy/common/gson/internal/AdapterTest.java b/policy-common/src/test/java/org/onap/policy/common/gson/internal/AdapterTest.java index ebe2b727f..ed7a84971 100644 --- a/policy-common/src/test/java/org/onap/policy/common/gson/internal/AdapterTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/gson/internal/AdapterTest.java @@ -83,7 +83,7 @@ class AdapterTest { private Data dataField; @BeforeAll - public static void setUpBeforeClass() { + static void setUpBeforeClass() { saveFactory = (Factory) ReflectionTestUtils.getField(Adapter.class, FACTORY_FIELD); } diff --git a/policy-common/src/test/java/org/onap/policy/common/gson/internal/ClassWalkerTest.java b/policy-common/src/test/java/org/onap/policy/common/gson/internal/ClassWalkerTest.java index 007724aed..ef65c9753 100644 --- a/policy-common/src/test/java/org/onap/policy/common/gson/internal/ClassWalkerTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/gson/internal/ClassWalkerTest.java @@ -358,6 +358,7 @@ class ClassWalkerTest { } // has a param - shouldn't be serialized + @SuppressWarnings("unused") public int getWithParams(String text) { return 1000; } diff --git a/policy-common/src/test/java/org/onap/policy/common/message/bus/event/TopicEndpointProxyTest.java b/policy-common/src/test/java/org/onap/policy/common/message/bus/event/TopicEndpointProxyTest.java index 6f0e38ddd..b7239c024 100644 --- a/policy-common/src/test/java/org/onap/policy/common/message/bus/event/TopicEndpointProxyTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/message/bus/event/TopicEndpointProxyTest.java @@ -107,7 +107,7 @@ class TopicEndpointProxyTest { * Destroys all managed topics. */ @AfterEach - public void tearDown() { + void tearDown() { NoopTopicFactories.getSinkFactory().destroy(); NoopTopicFactories.getSourceFactory().destroy(); KafkaTopicFactories.getSinkFactory().destroy(); diff --git a/policy-common/src/test/java/org/onap/policy/common/message/bus/event/base/BusConsumerTest.java b/policy-common/src/test/java/org/onap/policy/common/message/bus/event/base/BusConsumerTest.java index 207023e58..f8fe4101d 100644 --- a/policy-common/src/test/java/org/onap/policy/common/message/bus/event/base/BusConsumerTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/message/bus/event/base/BusConsumerTest.java @@ -72,7 +72,7 @@ class BusConsumerTest extends TopicTestBase { } @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { closeable.close(); } @@ -181,7 +181,7 @@ class BusConsumerTest extends TopicTestBase { KafkaConsumerWrapper kafkaConsumerWrapper = new KafkaConsumerWrapper(makeKafkaBuilder().build()); kafkaConsumerWrapper.consumer = mockedKafkaConsumer; - when(mockedKafkaConsumer.poll(any())).thenReturn(new ConsumerRecords<>(Collections.emptyMap())); + when(mockedKafkaConsumer.poll(any())).thenReturn(ConsumerRecords.empty()); Iterable result = kafkaConsumerWrapper.fetch(); @@ -195,6 +195,7 @@ class BusConsumerTest extends TopicTestBase { } @Test + @SuppressWarnings("deprecation") void testFetchWithMessages() { // Setup KafkaConsumerWrapper kafkaConsumerWrapper = new KafkaConsumerWrapper(makeKafkaBuilder().build()); @@ -224,6 +225,7 @@ class BusConsumerTest extends TopicTestBase { } @Test + @SuppressWarnings("deprecation") void testFetchWithMessagesAndTraceParent() { // Setup KafkaConsumerWrapper kafkaConsumerWrapper = new KafkaConsumerWrapper(makeKafkaBuilder().build()); diff --git a/policy-common/src/test/java/org/onap/policy/common/message/bus/event/base/InlineBusTopicSinkTest.java b/policy-common/src/test/java/org/onap/policy/common/message/bus/event/base/InlineBusTopicSinkTest.java index 820fc2c31..28e43b146 100644 --- a/policy-common/src/test/java/org/onap/policy/common/message/bus/event/base/InlineBusTopicSinkTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/message/bus/event/base/InlineBusTopicSinkTest.java @@ -57,7 +57,7 @@ class InlineBusTopicSinkTest extends TopicTestBase { } @AfterEach - public void tearDown() { + void tearDown() { sink.shutdown(); } diff --git a/policy-common/src/test/java/org/onap/policy/common/message/bus/event/base/SingleThreadedBusTopicSourceTest.java b/policy-common/src/test/java/org/onap/policy/common/message/bus/event/base/SingleThreadedBusTopicSourceTest.java index 8ad8e8fdb..0a8fcf826 100644 --- a/policy-common/src/test/java/org/onap/policy/common/message/bus/event/base/SingleThreadedBusTopicSourceTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/message/bus/event/base/SingleThreadedBusTopicSourceTest.java @@ -68,7 +68,7 @@ class SingleThreadedBusTopicSourceTest extends TopicTestBase { } @AfterEach - public void tearDown() { + void tearDown() { source.shutdown(); } diff --git a/policy-common/src/test/java/org/onap/policy/common/message/bus/event/base/TopicFactoryTestBase.java b/policy-common/src/test/java/org/onap/policy/common/message/bus/event/base/TopicFactoryTestBase.java index 8444b482f..ef35464c8 100644 --- a/policy-common/src/test/java/org/onap/policy/common/message/bus/event/base/TopicFactoryTestBase.java +++ b/policy-common/src/test/java/org/onap/policy/common/message/bus/event/base/TopicFactoryTestBase.java @@ -125,11 +125,10 @@ public abstract class TopicFactoryTestBase extends TopicTestBas List lst = buildTopics(builder.build()); assertEquals(4, lst.size()); - int index = 0; - T item = lst.get(index++); - assertNotSame(item, lst.get(index++)); - assertSame(item, lst.get(index++)); - assertSame(item, lst.get(index++)); + T item = lst.get(0); + assertNotSame(item, lst.get(1)); + assertSame(item, lst.get(2)); + assertSame(item, lst.get(3)); } /** @@ -140,9 +139,8 @@ public abstract class TopicFactoryTestBase extends TopicTestBas List lst = buildTopics(makePropBuilder().makeTopic(MY_TOPIC).makeTopic(TOPIC2).build()); - int index = 0; - T item1 = lst.get(index++); - T item2 = lst.get(index++); + T item1 = lst.get(0); + T item2 = lst.get(1); assertEquals(2, getInventory().size()); assertTrue(getInventory().contains(item1)); @@ -192,9 +190,8 @@ public abstract class TopicFactoryTestBase extends TopicTestBas List lst = buildTopics(makePropBuilder().makeTopic(MY_TOPIC).makeTopic(TOPIC2).build()); - int index = 0; - T item1 = lst.get(index++); - T item2 = lst.get(index++); + T item1 = lst.get(0); + T item2 = lst.get(1); item1.start(); item2.start(); diff --git a/policy-common/src/test/java/org/onap/policy/common/message/bus/event/client/TopicSinkClientTest.java b/policy-common/src/test/java/org/onap/policy/common/message/bus/event/client/TopicSinkClientTest.java index 67b15ec95..938f22248 100644 --- a/policy-common/src/test/java/org/onap/policy/common/message/bus/event/client/TopicSinkClientTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/message/bus/event/client/TopicSinkClientTest.java @@ -54,7 +54,7 @@ class TopicSinkClientTest { * @throws Exception if an error occurs */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { sink = mock(TopicSink.class); when(sink.send(anyString())).thenReturn(true); @@ -71,7 +71,7 @@ class TopicSinkClientTest { } @AfterAll - public static void tearDown() { + static void tearDown() { // clear all topics after the tests TopicEndpointManager.getManager().shutdown(); } diff --git a/policy-common/src/test/java/org/onap/policy/common/message/bus/event/kafka/InlineKafkaTopicSinkTest.java b/policy-common/src/test/java/org/onap/policy/common/message/bus/event/kafka/InlineKafkaTopicSinkTest.java index c8d6e21e3..d2461466b 100644 --- a/policy-common/src/test/java/org/onap/policy/common/message/bus/event/kafka/InlineKafkaTopicSinkTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/message/bus/event/kafka/InlineKafkaTopicSinkTest.java @@ -43,7 +43,7 @@ class InlineKafkaTopicSinkTest extends TopicTestBase { } @AfterEach - public void tearDown() { + void tearDown() { sink.shutdown(); } diff --git a/policy-common/src/test/java/org/onap/policy/common/message/bus/event/kafka/KafkaTopicSinkFactoryTest.java b/policy-common/src/test/java/org/onap/policy/common/message/bus/event/kafka/KafkaTopicSinkFactoryTest.java index 62210361c..d1fae7972 100644 --- a/policy-common/src/test/java/org/onap/policy/common/message/bus/event/kafka/KafkaTopicSinkFactoryTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/message/bus/event/kafka/KafkaTopicSinkFactoryTest.java @@ -52,7 +52,7 @@ class KafkaTopicSinkFactoryTest extends KafkaTopicFactoryTestBase, T exte // duplicate - should be the same, as these topics are managed List randomServers = new ArrayList<>(); - randomServers.add(RandomStringUtils.randomAlphanumeric(8)); + randomServers.add(RandomStringUtils.secure().nextAlphanumeric(8)); T item3 = buildTopic(randomServers, TOPIC2, true); assertSame(item2, item3); diff --git a/policy-common/src/test/java/org/onap/policy/common/message/bus/features/NetLoggerFeatureApiTest.java b/policy-common/src/test/java/org/onap/policy/common/message/bus/features/NetLoggerFeatureApiTest.java index 776c5d57a..1dae500d6 100644 --- a/policy-common/src/test/java/org/onap/policy/common/message/bus/features/NetLoggerFeatureApiTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/message/bus/features/NetLoggerFeatureApiTest.java @@ -44,7 +44,7 @@ class NetLoggerFeatureApiTest { private NetLoggerFeatureApi featureApi; @BeforeEach - public void setUp() { + void setUp() { featureApi = new NetLoggerFeatureApi() { @Override public boolean beforeLog(Logger eventLogger, EventType type, CommInfrastructure protocol, String topic, diff --git a/policy-common/src/test/java/org/onap/policy/common/message/bus/utils/NetLoggerUtilTest.java b/policy-common/src/test/java/org/onap/policy/common/message/bus/utils/NetLoggerUtilTest.java index df621f5b8..d9809fda9 100644 --- a/policy-common/src/test/java/org/onap/policy/common/message/bus/utils/NetLoggerUtilTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/message/bus/utils/NetLoggerUtilTest.java @@ -50,7 +50,7 @@ class NetLoggerUtilTest { * Obtains the test implementation of NetLoggerFeatureApi. */ @BeforeAll - public static void setUp() { + static void setUp() { netLoggerFeature = (NetLoggerFeature) NetLoggerFeatureProviders.getProviders().getList().get(0); } @@ -58,7 +58,7 @@ class NetLoggerUtilTest { * Clears events list and resets return/exceptions flags before invoking every unit test. */ @BeforeEach - public void reset() { + void reset() { TestAppender.clear(); netLoggerFeature.setReturnValue(false, false); netLoggerFeature.setExceptions(false, false); diff --git a/policy-common/src/test/java/org/onap/policy/common/parameters/topic/BusTopicParamsTest.java b/policy-common/src/test/java/org/onap/policy/common/parameters/topic/BusTopicParamsTest.java index c474e5fcc..656b88cd6 100644 --- a/policy-common/src/test/java/org/onap/policy/common/parameters/topic/BusTopicParamsTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/parameters/topic/BusTopicParamsTest.java @@ -61,7 +61,7 @@ class BusTopicParamsTest { protected TopicParamsBuilder builder; @BeforeEach - public void setUp() { + void setUp() { addProps = new TreeMap<>(); addProps.put("my-key-A", "my-value-A"); addProps.put("my-key-B", "my-value-B"); diff --git a/policy-common/src/test/java/org/onap/policy/common/spring/utils/CustomImplicitNamingStrategyTest.java b/policy-common/src/test/java/org/onap/policy/common/spring/utils/CustomImplicitNamingStrategyTest.java index e7c3ad5d7..09719dd3d 100644 --- a/policy-common/src/test/java/org/onap/policy/common/spring/utils/CustomImplicitNamingStrategyTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/spring/utils/CustomImplicitNamingStrategyTest.java @@ -42,7 +42,7 @@ class CustomImplicitNamingStrategyTest { static ImplicitJoinColumnNameSource source; @BeforeAll - public static void setUpBeforeClass() { + static void setUpBeforeClass() { strategy = new CustomImplicitNamingStrategy(); source = mock(ImplicitJoinColumnNameSource.class); } diff --git a/policy-common/src/test/java/org/onap/policy/common/utils/coder/StandardCoderObjectTest.java b/policy-common/src/test/java/org/onap/policy/common/utils/coder/StandardCoderObjectTest.java index 0e4967be2..16fff83a6 100644 --- a/policy-common/src/test/java/org/onap/policy/common/utils/coder/StandardCoderObjectTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/utils/coder/StandardCoderObjectTest.java @@ -50,7 +50,7 @@ class StandardCoderObjectTest { * @throws Exception if an error occurs */ @BeforeEach - public void setUp() throws Exception { + void setUp() throws Exception { sco = new StandardCoderObject(gson.fromJson(JSON, JsonElement.class)); } diff --git a/policy-common/src/test/java/org/onap/policy/common/utils/coder/StandardCoderTest.java b/policy-common/src/test/java/org/onap/policy/common/utils/coder/StandardCoderTest.java index 269893e72..45feb3508 100644 --- a/policy-common/src/test/java/org/onap/policy/common/utils/coder/StandardCoderTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/utils/coder/StandardCoderTest.java @@ -66,7 +66,7 @@ class StandardCoderTest { private StandardCoder coder; @BeforeEach - public void setUp() { + void setUp() { coder = new StandardCoder(); } diff --git a/policy-common/src/test/java/org/onap/policy/common/utils/coder/StandardYamlCoderTest.java b/policy-common/src/test/java/org/onap/policy/common/utils/coder/StandardYamlCoderTest.java index d504b82be..51933b132 100644 --- a/policy-common/src/test/java/org/onap/policy/common/utils/coder/StandardYamlCoderTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/utils/coder/StandardYamlCoderTest.java @@ -43,7 +43,7 @@ class StandardYamlCoderTest { private Container cont; @BeforeEach - public void setUp() throws CoderException { + void setUp() throws CoderException { coder = new StandardYamlCoder(); cont = coder.decode(YAML_FILE, Container.class); } diff --git a/policy-common/src/test/java/org/onap/policy/common/utils/coder/YamlJsonTranslatorTest.java b/policy-common/src/test/java/org/onap/policy/common/utils/coder/YamlJsonTranslatorTest.java index 563181c02..1b82238f8 100644 --- a/policy-common/src/test/java/org/onap/policy/common/utils/coder/YamlJsonTranslatorTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/utils/coder/YamlJsonTranslatorTest.java @@ -53,7 +53,7 @@ class YamlJsonTranslatorTest { * @throws IOException if an error occurs */ @BeforeEach - public void setUp() throws IOException { + void setUp() throws IOException { translator = new YamlJsonTranslator(); try (FileReader rdr = new FileReader(YAML_FILE)) { diff --git a/policy-common/src/test/java/org/onap/policy/common/utils/gson/GsonTestUtilsBuilderTest.java b/policy-common/src/test/java/org/onap/policy/common/utils/gson/GsonTestUtilsBuilderTest.java index d85653d94..105f678db 100644 --- a/policy-common/src/test/java/org/onap/policy/common/utils/gson/GsonTestUtilsBuilderTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/utils/gson/GsonTestUtilsBuilderTest.java @@ -39,7 +39,7 @@ class GsonTestUtilsBuilderTest { private GsonTestUtils utils; @BeforeEach - public void setUp() { + void setUp() { utils = new MyBuilder().build(); } diff --git a/policy-common/src/test/java/org/onap/policy/common/utils/gson/GsonTestUtilsTest.java b/policy-common/src/test/java/org/onap/policy/common/utils/gson/GsonTestUtilsTest.java index d355823c1..20b78b8df 100644 --- a/policy-common/src/test/java/org/onap/policy/common/utils/gson/GsonTestUtilsTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/utils/gson/GsonTestUtilsTest.java @@ -47,7 +47,7 @@ class GsonTestUtilsTest { private GsonTestUtils utils; @BeforeEach - public void setUp() { + void setUp() { utils = new GsonTestUtils(); } diff --git a/policy-common/src/test/java/org/onap/policy/common/utils/properties/PropertyUtilsTest.java b/policy-common/src/test/java/org/onap/policy/common/utils/properties/PropertyUtilsTest.java index a8b37f574..b1ca0184f 100644 --- a/policy-common/src/test/java/org/onap/policy/common/utils/properties/PropertyUtilsTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/utils/properties/PropertyUtilsTest.java @@ -43,7 +43,7 @@ class PropertyUtilsTest { * Initializes {@link #utils}. */ @BeforeEach - public void setUp() { + void setUp() { Properties properties = new Properties(); properties.put("myPrefix.my-string", "some text"); properties.put("myPrefix.empty-string", ""); diff --git a/policy-common/src/test/java/org/onap/policy/common/utils/resources/ResourceUtilsTest.java b/policy-common/src/test/java/org/onap/policy/common/utils/resources/ResourceUtilsTest.java index 7b41d9765..b3369cb2c 100644 --- a/policy-common/src/test/java/org/onap/policy/common/utils/resources/ResourceUtilsTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/utils/resources/ResourceUtilsTest.java @@ -64,7 +64,7 @@ class ResourceUtilsTest { * @throws IOException Signals that an I/O exception has occurred. */ @BeforeEach - public void setupResourceUtilsTest() throws IOException { + void setupResourceUtilsTest() throws IOException { tmpDir = new File(System.getProperty("java.io.tmpdir")); tmpEmptyFile = File.createTempFile(this.getClass().getName(), ".tmp"); tmpUsedFile = File.createTempFile(this.getClass().getName(), ".tmp"); @@ -81,7 +81,7 @@ class ResourceUtilsTest { * Clean resource utils test. */ @AfterEach - public void cleanDownResourceUtilsTest() { + void cleanDownResourceUtilsTest() { assertTrue(tmpEmptyFile.delete()); assertTrue(tmpUsedFile.delete()); } diff --git a/policy-common/src/test/java/org/onap/policy/common/utils/services/FeatureApiUtilsTest.java b/policy-common/src/test/java/org/onap/policy/common/utils/services/FeatureApiUtilsTest.java index 3de937795..3d80323f2 100644 --- a/policy-common/src/test/java/org/onap/policy/common/utils/services/FeatureApiUtilsTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/utils/services/FeatureApiUtilsTest.java @@ -43,7 +43,7 @@ class FeatureApiUtilsTest { * Initializes fields. */ @BeforeEach - public void setUp() { + void setUp() { tried = new LinkedList<>(); errors = new LinkedList<>(); pred = new MyPred(); diff --git a/policy-common/src/test/java/org/onap/policy/common/utils/services/OrderedServiceImplTest.java b/policy-common/src/test/java/org/onap/policy/common/utils/services/OrderedServiceImplTest.java index 1508009fa..52c3a9cd8 100644 --- a/policy-common/src/test/java/org/onap/policy/common/utils/services/OrderedServiceImplTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/utils/services/OrderedServiceImplTest.java @@ -40,7 +40,7 @@ class OrderedServiceImplTest { * Saves the original state of the ordered service list to restore after each test. */ @BeforeAll - public static void setup() { + static void setup() { List implementers = GenericService.providers.getList(); highPrioService = implementers.get(0); lowPrioService = implementers.get(1); @@ -50,7 +50,7 @@ class OrderedServiceImplTest { * Restores original state after each test. */ @BeforeEach - public void resetOrder() { + void resetOrder() { highPrioService.setSequenceNumber(HIGH_PRIORITY_NUM); lowPrioService.setSequenceNumber(LOW_PRIORITY_NUM); } @@ -203,4 +203,4 @@ class OrderedServiceImplTest { } -} \ No newline at end of file +} diff --git a/policy-common/src/test/java/org/onap/policy/common/utils/services/ServiceManagerContainerTest.java b/policy-common/src/test/java/org/onap/policy/common/utils/services/ServiceManagerContainerTest.java index 1bae46cb1..080b9a3e4 100644 --- a/policy-common/src/test/java/org/onap/policy/common/utils/services/ServiceManagerContainerTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/utils/services/ServiceManagerContainerTest.java @@ -46,7 +46,7 @@ class ServiceManagerContainerTest { * Set up. */ @BeforeEach - public void setUp() { + void setUp() { starter = mock(RunnableWithEx.class); stopper = mock(RunnableWithEx.class); startObj = mock(Startable.class); diff --git a/policy-common/src/test/java/org/onap/policy/common/utils/services/ServiceManagerTest.java b/policy-common/src/test/java/org/onap/policy/common/utils/services/ServiceManagerTest.java index dc5555842..95c63d4a4 100644 --- a/policy-common/src/test/java/org/onap/policy/common/utils/services/ServiceManagerTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/utils/services/ServiceManagerTest.java @@ -49,7 +49,7 @@ class ServiceManagerTest { * Initializes {@link #svcmgr}. */ @BeforeEach - public void setUp() { + void setUp() { svcmgr = new ServiceManager(MY_NAME); } diff --git a/policy-common/src/test/java/org/onap/policy/common/utils/test/ExceptionsTesterTest.java b/policy-common/src/test/java/org/onap/policy/common/utils/test/ExceptionsTesterTest.java index 81a850354..2004009f5 100644 --- a/policy-common/src/test/java/org/onap/policy/common/utils/test/ExceptionsTesterTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/utils/test/ExceptionsTesterTest.java @@ -48,6 +48,7 @@ class ExceptionsTesterTest { public static class NoConstructorsException extends Exception { private static final long serialVersionUID = 1L; + @SuppressWarnings("unused") public NoConstructorsException(int value) { super(); } diff --git a/policy-common/src/test/java/org/onap/policy/common/utils/test/ThrowablesTesterTest.java b/policy-common/src/test/java/org/onap/policy/common/utils/test/ThrowablesTesterTest.java index 7775ef35b..0a437b57c 100644 --- a/policy-common/src/test/java/org/onap/policy/common/utils/test/ThrowablesTesterTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/utils/test/ThrowablesTesterTest.java @@ -119,6 +119,7 @@ class ThrowablesTesterTest { public static class NoConstructorsThrowable extends Throwable { private static final long serialVersionUID = 1L; + @SuppressWarnings("unused") public NoConstructorsThrowable(int value) { super(); } diff --git a/policy-common/src/test/java/org/onap/policy/common/utils/test/log/logback/ExtractAppenderTest.java b/policy-common/src/test/java/org/onap/policy/common/utils/test/log/logback/ExtractAppenderTest.java index 9367209cd..f7fd24bdd 100644 --- a/policy-common/src/test/java/org/onap/policy/common/utils/test/log/logback/ExtractAppenderTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/utils/test/log/logback/ExtractAppenderTest.java @@ -60,13 +60,13 @@ class ExtractAppenderTest { private List threads; @BeforeAll - public static void setUpBeforeClass() { + static void setUpBeforeClass() { logger = (Logger) LoggerFactory.getLogger(ExtractAppenderTest.class); logger.setLevel(Level.INFO); } @BeforeEach - public void setUp() { + void setUp() { threads = new LinkedList<>(); } @@ -74,7 +74,7 @@ class ExtractAppenderTest { * Tear down all appenders and threads. */ @AfterEach - public void tearDown() throws Exception { + void tearDown() throws Exception { logger.detachAndStopAllAppenders(); for (Thread p : threads) { diff --git a/policy-common/src/test/java/org/onap/policy/common/utils/validation/VersionTest.java b/policy-common/src/test/java/org/onap/policy/common/utils/validation/VersionTest.java index 190231242..5d5c5da10 100644 --- a/policy-common/src/test/java/org/onap/policy/common/utils/validation/VersionTest.java +++ b/policy-common/src/test/java/org/onap/policy/common/utils/validation/VersionTest.java @@ -40,7 +40,7 @@ class VersionTest { private Version vers; @BeforeEach - public void setUp() { + void setUp() { vers = new Version(MAJOR, MINOR, PATCH); }