X-Git-Url: https://gerrit.onap.org/r/gitweb?p=cps.git;a=blobdiff_plain;f=cps-service%2Fsrc%2Ftest%2Fgroovy%2Forg%2Fonap%2Fcps%2Futils%2FCpsValidatorSpec.groovy;h=ce728ef1c18bd156fe05900e0747d244affb830f;hp=191472ceea6bedaa768884a24881bfe83f057275;hb=ea01d09861289ff162dff318713d1c24eba89259;hpb=d69742c1f02585ae5d82f49542581698367e9cde diff --git a/cps-service/src/test/groovy/org/onap/cps/utils/CpsValidatorSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/utils/CpsValidatorSpec.groovy index 191472cee..ce728ef1c 100644 --- a/cps-service/src/test/groovy/org/onap/cps/utils/CpsValidatorSpec.groovy +++ b/cps-service/src/test/groovy/org/onap/cps/utils/CpsValidatorSpec.groovy @@ -45,4 +45,18 @@ class CpsValidatorSpec extends Specification { 'position 5' | 'name with spaces' || 'name with spaces invalid token encountered at position 5' 'position 9' | 'nameWith Space' || 'nameWith Space invalid token encountered at position 9' } + + def 'Validating topic names.'() { + when: 'the topic name is validated' + def isValidTopicName = CpsValidator.validateTopicName(topicName) + then: 'boolean response will be returned for #scenario' + assert isValidTopicName == booleanResponse + where: 'the following names are used' + scenario | topicName || booleanResponse + 'valid topic' | 'my-topic-name' || true + 'empty topic' | '' || false + 'blank topic' | ' ' || false + 'null topic' | null || false + 'invalid non empty topic' | '1_5_*_#' || false + } }