From 69563ed36cd4aa6876aee517c9c228d94e52ba91 Mon Sep 17 00:00:00 2001 From: leventecsanyi Date: Wed, 12 Oct 2022 11:51:47 +0200 Subject: Fix SonarQube Violations - Fixed SonarCube issue: added private constructor to TopicValidator and a unit test. Issue-ID: CPS-475 Change-Id: I4379522f023f32c8999a3ee595392bfbab147050 Signed-off-by: leventecsanyi --- .../src/main/java/org/onap/cps/ncmp/rest/util/TopicValidator.java | 3 +++ .../test/groovy/org/onap/cps/ncmp/rest/util/TopicValidatorSpec.groovy | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/util/TopicValidator.java b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/util/TopicValidator.java index 313e7bc012..6a46fbd638 100644 --- a/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/util/TopicValidator.java +++ b/cps-ncmp-rest/src/main/java/org/onap/cps/ncmp/rest/util/TopicValidator.java @@ -21,8 +21,11 @@ package org.onap.cps.ncmp.rest.util; import java.util.regex.Pattern; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; import org.onap.cps.ncmp.rest.exceptions.InvalidTopicException; +@NoArgsConstructor(access = AccessLevel.PRIVATE) public class TopicValidator { private static final Pattern TOPIC_NAME_PATTERN = Pattern.compile("^[a-zA-Z0-9]([._-](?![._-])|" diff --git a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/util/TopicValidatorSpec.groovy b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/util/TopicValidatorSpec.groovy index e626e1505d..15e2c1c6a0 100644 --- a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/util/TopicValidatorSpec.groovy +++ b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/util/TopicValidatorSpec.groovy @@ -43,5 +43,4 @@ class TopicValidatorSpec extends Specification { 'blank topic' | ' ' 'invalid non empty topic' | '1_5_*_#' } - } -- cgit 1.2.3-korg