27f74821124b7ad0b90d14b71080fd1f1de14834
[cps.git] / cps / cps-service / src / test / groovy / org / onap / cps / api / impl / CpServiceImplSpec.groovy
1 package org.onap.cps.api.impl
2
3 import org.onap.cps.spi.DataPersistencyService
4 import spock.lang.Specification;
5
6
7 class CpServiceImplSpec extends Specification {
8
9     def dataPersistencyService = Mock(DataPersistencyService)
10     def objectUnderTest = new CpServiceImpl()
11
12     def setup() {
13         // Insert mocked dependencies
14         objectUnderTest.dataPersistencyService = dataPersistencyService;
15     }
16
17     def 'Storing a json object'() {
18         given: 'that the data persistency service returns an id of 123'
19             dataPersistencyService.storeJsonStructure(_) >> 123
20
21         when: 'a json structure is stored using the data persistency service'
22             def result = objectUnderTest.storeJsonStructure('')
23
24         then: ' the same id is returned'
25             result == 123
26     }
27 }