X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cps-rest%2Fsrc%2Ftest%2Fgroovy%2Forg%2Fonap%2Fcps%2Frest%2Fexceptions%2FCpsRestExceptionHandlerSpec.groovy;h=e427c6063e2d5ca858ecc10261b94c33a4668af1;hb=a0da7f6b3e04ee6f06f4580f8a14e60f3438d5e7;hp=d951cbeb69aa68bf77a916b9c189cbdc12ac38e9;hpb=e182a6b6cb4a87b4f461adf83fe60a65948fc230;p=cps.git diff --git a/cps-rest/src/test/groovy/org/onap/cps/rest/exceptions/CpsRestExceptionHandlerSpec.groovy b/cps-rest/src/test/groovy/org/onap/cps/rest/exceptions/CpsRestExceptionHandlerSpec.groovy index d951cbeb6..e427c6063 100644 --- a/cps-rest/src/test/groovy/org/onap/cps/rest/exceptions/CpsRestExceptionHandlerSpec.groovy +++ b/cps-rest/src/test/groovy/org/onap/cps/rest/exceptions/CpsRestExceptionHandlerSpec.groovy @@ -20,7 +20,7 @@ package org.onap.cps.rest.exceptions import groovy.json.JsonSlurper -import org.onap.cps.api.CpService +import org.onap.cps.api.CpsAdminService import org.onap.cps.spi.exceptions.AnchorAlreadyDefinedException import org.onap.cps.spi.exceptions.CpsException import org.onap.cps.spi.exceptions.DataValidationException @@ -50,12 +50,12 @@ class CpsRestExceptionHandlerSpec extends Specification { def existingObjectName = 'MyAdminObject' def cpsRestController = new CpsRestController() - def mockCpService = Mock(CpService.class) + def mockCpsAdminService = Mock(CpsAdminService.class) def objectUnderTest = new CpsRestExceptionHandler() def mockMvc = standaloneSetup(cpsRestController).setControllerAdvice(objectUnderTest).build() def setup() { - cpsRestController.cpService = mockCpService + cpsRestController.cpsAdminService = mockCpsAdminService } def 'Get request with runtime exception returns HTTP Status Internal Server Error'() { @@ -130,11 +130,11 @@ class CpsRestExceptionHandlerSpec extends Specification { */ def setupTestException(exception) { - mockCpService.getJsonById(_) >> { throw exception } + mockCpsAdminService.getAnchors(_) >> { throw exception} } def performTestRequest() { - return mockMvc.perform(get('/json-object/1')).andReturn().response + return mockMvc.perform(get('/v1/dataspaces/dataspace-name/anchors')).andReturn().response } void assertTestResponse(response, expectedStatus, expectedErrorMessage, expectedErrorDetails) {