From 8309dc93f39f8fbe5ba899f8311781ab9729986d Mon Sep 17 00:00:00 2001 From: Pamela Dragosh Date: Thu, 1 Feb 2018 15:10:57 -0500 Subject: Reduce technical debt add coverage * add empty constructor message * remove unnecessary exception declaration * add @FunctionalInterface declaration * switched around public static per java conventions * fixed up JUnit ordering * added some trivial JUnit tests to bump coverage > 70% Issue-ID: POLICY-460 Change-Id: I13b6de29f66d692143b06180feed76dd6332d6cf Signed-off-by: Pamela Dragosh --- .../src/main/java/org/onap/policy/drools/utils/LoggerUtil.java | 4 ++++ .../src/main/java/org/onap/policy/drools/utils/NetworkUtil.java | 3 +++ .../src/main/java/org/onap/policy/drools/utils/OrderedService.java | 1 + .../src/main/java/org/onap/policy/drools/utils/ReflectionUtil.java | 6 ++---- 4 files changed, 10 insertions(+), 4 deletions(-) (limited to 'policy-utils/src/main/java') diff --git a/policy-utils/src/main/java/org/onap/policy/drools/utils/LoggerUtil.java b/policy-utils/src/main/java/org/onap/policy/drools/utils/LoggerUtil.java index 257d2dae..681a2b20 100644 --- a/policy-utils/src/main/java/org/onap/policy/drools/utils/LoggerUtil.java +++ b/policy-utils/src/main/java/org/onap/policy/drools/utils/LoggerUtil.java @@ -32,6 +32,10 @@ public class LoggerUtil { * Root logger */ public static final String ROOT_LOGGER = "ROOT"; + + private LoggerUtil() { + // Empty constructor + } /** * set the log level of a logger diff --git a/policy-utils/src/main/java/org/onap/policy/drools/utils/NetworkUtil.java b/policy-utils/src/main/java/org/onap/policy/drools/utils/NetworkUtil.java index bd5b8aac..6734226d 100644 --- a/policy-utils/src/main/java/org/onap/policy/drools/utils/NetworkUtil.java +++ b/policy-utils/src/main/java/org/onap/policy/drools/utils/NetworkUtil.java @@ -39,6 +39,9 @@ public class NetworkUtil { */ public static final String IPv4_WILDCARD_ADDRESS = "0.0.0.0"; + private NetworkUtil() { + // Empty constructor + } /** * try to connect to $host:$port $retries times while we are getting connection failures. diff --git a/policy-utils/src/main/java/org/onap/policy/drools/utils/OrderedService.java b/policy-utils/src/main/java/org/onap/policy/drools/utils/OrderedService.java index 75a3cd7d..7a6ca0a0 100644 --- a/policy-utils/src/main/java/org/onap/policy/drools/utils/OrderedService.java +++ b/policy-utils/src/main/java/org/onap/policy/drools/utils/OrderedService.java @@ -25,6 +25,7 @@ package org.onap.policy.drools.utils; * of services (features) discovered via 'ServiceLoader'. See * 'OrderedServiceImpl' for more details. */ +@FunctionalInterface public interface OrderedService { /** diff --git a/policy-utils/src/main/java/org/onap/policy/drools/utils/ReflectionUtil.java b/policy-utils/src/main/java/org/onap/policy/drools/utils/ReflectionUtil.java index 50135e84..bf59ec96 100644 --- a/policy-utils/src/main/java/org/onap/policy/drools/utils/ReflectionUtil.java +++ b/policy-utils/src/main/java/org/onap/policy/drools/utils/ReflectionUtil.java @@ -45,8 +45,7 @@ public class ReflectionUtil { * @throws IllegalArgumentException if an invalid parameter has been passed in */ public static Class fetchClass(ClassLoader classLoader, - String className) - throws IllegalArgumentException { + String className) { if (classLoader == null) throw new IllegalArgumentException("A class loader must be provided"); @@ -70,8 +69,7 @@ public class ReflectionUtil { * @return true if exists * @throws IllegalArgumentException if an invalid parameter has been passed in */ - public static boolean isClass(ClassLoader classLoader, String classname) - throws IllegalArgumentException { + public static boolean isClass(ClassLoader classLoader, String classname) { return fetchClass(classLoader, classname) != null; } -- cgit 1.2.3-korg