diff options
author | ToineSiebelink <toine.siebelink@est.tech> | 2022-04-05 13:54:32 +0100 |
---|---|---|
committer | ToineSiebelink <toine.siebelink@est.tech> | 2022-04-06 10:10:56 +0100 |
commit | 54d10a74fdd8cfcb89fd1c0ab91abefdf0602367 (patch) | |
tree | 25e5d499b9074577db69a04d844186dc2424c639 /src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/ControllerSecuritySpec.groovy | |
parent | 39450c583c097c3b083ca79a39c5f99a218f6cdc (diff) |
Improve branch coverage
- update to oparent 3.3.0 to allow for checkstyle @SupressWarnings (not used in the end)
- refactor code to minimize unused branches (no more switch-statements :-))
- Added test for neccessary but uncovered branches
Issue-ID: CPS-475
Signed-off-by: ToineSiebelink <toine.siebelink@est.tech>
Change-Id: I03c7355a7e9d19f57523a65fbff45c9d8f1c9e07
Diffstat (limited to 'src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/ControllerSecuritySpec.groovy')
-rw-r--r-- | src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/ControllerSecuritySpec.groovy | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/ControllerSecuritySpec.groovy b/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/ControllerSecuritySpec.groovy index 14ab7147..8b13fc79 100644 --- a/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/ControllerSecuritySpec.groovy +++ b/src/test/groovy/org/onap/cps/ncmp/dmi/rest/controller/ControllerSecuritySpec.groovy @@ -1,6 +1,6 @@ /* * ============LICENSE_START======================================================= - * Copyright (C) 2021 Nordix Foundation + * Copyright (C) 2021-2022 Nordix Foundation * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,8 @@ package org.onap.cps.ncmp.dmi.rest.controller +import org.onap.cps.ncmp.dmi.config.WebSecurityConfig + import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get import org.springframework.beans.factory.annotation.Autowired @@ -60,4 +62,13 @@ class ControllerSecuritySpec extends Specification { then: 'HTTP Unauthorized status code is returned' assert response.status == HttpStatus.UNAUTHORIZED.value() } + + def 'Security Config #scenario permit URIs'() { + expect: 'can create a web security configuration' + new WebSecurityConfig(permitUris,'user','password') + where: 'the following string of permit URIs is provided' + scenario | permitUris + 'with' | 'a,b' + 'without' | '' + } } |