summaryrefslogtreecommitdiffstats
path: root/cps-ncmp-rest/src
diff options
context:
space:
mode:
authorsourabh_sourabh <sourabh.sourabh@est.tech>2023-10-17 14:16:25 +0100
committersourabh_sourabh <sourabh.sourabh@est.tech>2023-10-19 11:15:04 +0100
commit3ccd62ed40e96dbe2970de1433b2ebdbe014d4aa (patch)
tree67ef07f6482b465e898d85ebd2be5a1f2aa883ee /cps-ncmp-rest/src
parent964fd24568228c6d9d3b93925b5b27dfed911714 (diff)
Code coverage: Update YANG schema set using moduleSetTag
- Code coverage is increased to 98. - New groovy test is added to cover new code. Issue-ID: CPS-1798 Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech> Change-Id: Ia979be3f43ec8e4bbf6f8cb66a8a5e748118f19b Signed-off-by: sourabh_sourabh <sourabh.sourabh@est.tech>
Diffstat (limited to 'cps-ncmp-rest/src')
-rw-r--r--cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandlerSpec.groovy19
1 files changed, 11 insertions, 8 deletions
diff --git a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandlerSpec.groovy b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandlerSpec.groovy
index 592f1d165a..dd02b312a8 100644
--- a/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandlerSpec.groovy
+++ b/cps-ncmp-rest/src/test/groovy/org/onap/cps/ncmp/rest/exceptions/NetworkCmProxyRestExceptionHandlerSpec.groovy
@@ -21,6 +21,16 @@
package org.onap.cps.ncmp.rest.exceptions
+import static org.springframework.http.HttpStatus.BAD_GATEWAY
+import static org.springframework.http.HttpStatus.BAD_REQUEST
+import static org.springframework.http.HttpStatus.INTERNAL_SERVER_ERROR
+import static org.springframework.http.HttpStatus.NOT_FOUND
+import static org.springframework.http.HttpStatus.CONFLICT
+import static org.onap.cps.ncmp.rest.exceptions.NetworkCmProxyRestExceptionHandlerSpec.ApiType.NCMP
+import static org.onap.cps.ncmp.rest.exceptions.NetworkCmProxyRestExceptionHandlerSpec.ApiType.NCMPINVENTORY
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post
+
import groovy.json.JsonSlurper
import org.mapstruct.factory.Mappers
import org.onap.cps.TestUtils
@@ -44,18 +54,11 @@ import org.spockframework.spring.SpringBean
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest
-import org.springframework.http.HttpStatus
import org.springframework.http.MediaType
import org.springframework.test.web.servlet.MockMvc
import spock.lang.Shared
import spock.lang.Specification
-import static org.onap.cps.ncmp.rest.exceptions.NetworkCmProxyRestExceptionHandlerSpec.ApiType.NCMP
-import static org.onap.cps.ncmp.rest.exceptions.NetworkCmProxyRestExceptionHandlerSpec.ApiType.NCMPINVENTORY
-import static org.springframework.http.HttpStatus.*
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post
-
@WebMvcTest
class NetworkCmProxyRestExceptionHandlerSpec extends Specification {
@@ -142,7 +145,7 @@ class NetworkCmProxyRestExceptionHandlerSpec extends Specification {
when: 'the DMI request is executed'
def response = performTestRequest(NCMP)
then: 'NCMP service responds with 502 Bad Gateway status'
- response.status == HttpStatus.BAD_GATEWAY.value()
+ response.status == BAD_GATEWAY.value()
and: 'the NCMP response also contains the original DMI response details'
response.contentAsString.contains('400')
response.contentAsString.contains('Bad Request from DMI')