aboutsummaryrefslogtreecommitdiffstats
path: root/cps-service/src/test/groovy/org/onap
diff options
context:
space:
mode:
Diffstat (limited to 'cps-service/src/test/groovy/org/onap')
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy8
-rw-r--r--cps-service/src/test/groovy/org/onap/cps/utils/JsonObjectMapperSpec.groovy7
2 files changed, 12 insertions, 3 deletions
diff --git a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy
index 95d731478..429de7d51 100644
--- a/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy
+++ b/cps-service/src/test/groovy/org/onap/cps/api/impl/CpsModuleServiceImplSpec.groovy
@@ -24,7 +24,6 @@ package org.onap.cps.api.impl
import org.onap.cps.TestUtils
import org.onap.cps.api.CpsAdminService
-import org.onap.cps.spi.CascadeDeleteAllowed
import org.onap.cps.spi.CpsModulePersistenceService
import org.onap.cps.spi.exceptions.DataValidationException
import org.onap.cps.spi.exceptions.ModelValidationException
@@ -243,4 +242,11 @@ class CpsModuleServiceImplSpec extends Specification {
then: 'cps module persistence service is called with module references to check'
1 * mockCpsModulePersistenceService.identifyNewModuleReferences(moduleReferencesToCheck);
}
+
+ def 'Getting module definitions.'() {
+ when: 'get module definitions method is called with a valid dataspace and anchor name'
+ objectUnderTest.getModuleDefinitionsByAnchorName('some-dataspace-name', 'some-anchor-name')
+ then: 'CPS module persistence service is invoked the correct number of times'
+ 1 * mockCpsModulePersistenceService.getYangResourceDefinitions('some-dataspace-name', 'some-anchor-name')
+ }
}
diff --git a/cps-service/src/test/groovy/org/onap/cps/utils/JsonObjectMapperSpec.groovy b/cps-service/src/test/groovy/org/onap/cps/utils/JsonObjectMapperSpec.groovy
index acb52413f..461014418 100644
--- a/cps-service/src/test/groovy/org/onap/cps/utils/JsonObjectMapperSpec.groovy
+++ b/cps-service/src/test/groovy/org/onap/cps/utils/JsonObjectMapperSpec.groovy
@@ -22,6 +22,7 @@ package org.onap.cps.utils
import com.fasterxml.jackson.databind.ObjectMapper
+import com.fasterxml.jackson.databind.SerializationFeature
import groovy.json.JsonSlurper
import org.onap.cps.TestUtils
import org.onap.cps.spi.exceptions.DataValidationException
@@ -79,10 +80,12 @@ class JsonObjectMapperSpec extends Specification {
def 'Map a unstructured object to json String.'() {
given: 'Unstructured object'
def object = new Object()
+ and: 'disable serialization failure on empty bean'
+ spiedObjectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
when: 'the object is mapped to string'
jsonObjectMapper.asJsonString(object);
- then: 'an exception is thrown'
- thrown(DataValidationException)
+ then: 'no exception is thrown'
+ noExceptionThrown()
}
def 'Map a structurally compatible json String to JsonNode.'() {