Internal Server Error when creating the same data node twice
[cps.git] / cps-rest / src / test / groovy / org / onap / cps / rest / controller / DataRestControllerSpec.groovy
index 15627d5..5794f88 100755 (executable)
@@ -33,6 +33,7 @@ import org.onap.cps.api.CpsAdminService
 import org.onap.cps.api.CpsDataService
 import org.onap.cps.api.CpsModuleService
 import org.onap.cps.api.CpsQueryService
+import org.onap.cps.spi.exceptions.AlreadyDefinedException
 import org.onap.cps.spi.exceptions.AnchorNotFoundException
 import org.onap.cps.spi.exceptions.DataNodeNotFoundException
 import org.onap.cps.spi.exceptions.DataspaceNotFoundException
@@ -159,11 +160,12 @@ class DataRestControllerSpec extends Specification {
         then: 'a success response is returned'
             response.status == httpStatus.value()
         where:
-            scenario       | xpath     | exception                                 || httpStatus
-            'no dataspace' | '/x-path' | new DataspaceNotFoundException('')        || HttpStatus.BAD_REQUEST
-            'no anchor'    | '/x-path' | new AnchorNotFoundException('', '')       || HttpStatus.BAD_REQUEST
-            'no data'      | '/x-path' | new DataNodeNotFoundException('', '', '') || HttpStatus.NOT_FOUND
-            'empty path'   | ''        | new IllegalStateException()               || HttpStatus.NOT_IMPLEMENTED
+            scenario          | xpath     | exception                                 || httpStatus
+            'no dataspace'    | '/x-path' | new DataspaceNotFoundException('')        || HttpStatus.BAD_REQUEST
+            'no anchor'       | '/x-path' | new AnchorNotFoundException('', '')       || HttpStatus.BAD_REQUEST
+            'no data'         | '/x-path' | new DataNodeNotFoundException('', '', '') || HttpStatus.NOT_FOUND
+            'empty path'      | ''        | new IllegalStateException()               || HttpStatus.NOT_IMPLEMENTED
+            'already defined' | '/x-path' | new AlreadyDefinedException('', '')       || HttpStatus.CONFLICT
     }
 
     @Unroll