Merge "CPS-723: Add Examples in the NCMP openapi"
[cps.git] / cps-rest / src / test / groovy / org / onap / cps / rest / exceptions / CpsRestExceptionHandlerSpec.groovy
index 079a59c..658dcaa 100644 (file)
@@ -37,6 +37,7 @@ import org.onap.cps.spi.exceptions.DataValidationException
 import org.onap.cps.spi.exceptions.ModelValidationException
 import org.onap.cps.spi.exceptions.NotFoundInDataspaceException
 import org.onap.cps.spi.exceptions.SchemaSetInUseException
+import org.onap.cps.spi.exceptions.DataspaceInUseException
 import org.spockframework.spring.SpringBean
 import org.springframework.beans.factory.annotation.Autowired
 import org.springframework.beans.factory.annotation.Value
@@ -145,7 +146,8 @@ class CpsRestExceptionHandlerSpec extends Specification {
             assertTestResponse(response, CONFLICT, exceptionThrown.getMessage(), exceptionThrown.getDetails())
         where: 'the following exceptions are thrown'
             exceptionThrown << [new DataInUseException(dataspaceName, existingObjectName),
-                                new SchemaSetInUseException(dataspaceName, existingObjectName)]
+                                new SchemaSetInUseException(dataspaceName, existingObjectName),
+                                new DataspaceInUseException(dataspaceName, errorDetails)]
     }
 
     /*
@@ -161,7 +163,7 @@ class CpsRestExceptionHandlerSpec extends Specification {
                 post("$basePath/v1/dataspaces/dataspace-name/anchors/anchor-name/nodes")
                     .contentType(MediaType.APPLICATION_JSON)
                     .param('xpath', 'parent node xpath')
-                    .content('json data')
+                    .content(groovy.json.JsonOutput.toJson('{"some-key" : "some-value"}'))
             ).andReturn().response
         then: 'response code indicates bad input parameters'
             response.status == BAD_REQUEST.value()