- def 'Replace data node using singular data node with invalid #scenario.'() {
- when: 'replace data method is invoked with invalid #scenario'
- objectUnderTest.updateDataNodeAndDescendants(dataspaceName, anchorName, '/', _ as String, observedTimestamp)
- then: 'a data validation exception is thrown'
- thrown(DataValidationException)
- and: 'the persistence service method is not invoked'
- 0 * mockCpsDataPersistenceService.updateDataNodeAndDescendants(*_)
- and: 'data updated event is not sent to notification service'
- 0 * mockNotificationService.processDataUpdatedEvent(*_)
- where: 'the following parameters are used'
- scenario | dataspaceName | anchorName
- 'dataspace name' | 'dataspace names with spaces' | 'anchorName'
- 'anchor name' | 'dataspaceName' | 'anchor name with spaces'
- 'dataspace and anchor name' | 'dataspace name with spaces' | 'anchor name with spaces'
- }
-
- def 'Replace data node using multiple data nodes with invalid #scenario.'() {
- when: 'replace data method is invoked with invalid #scenario'
- objectUnderTest.updateDataNodesAndDescendants(dataspaceName, anchorName, ['/': _ as String], observedTimestamp)
- then: 'a data validation exception is thrown'
- thrown(DataValidationException)
- and: 'the persistence service method is not invoked'
- 0 * mockCpsDataPersistenceService.updateDataNodesAndDescendants(*_)
- and: 'data updated event is not sent to notification service'
- 0 * mockNotificationService.processDataUpdatedEvent(*_)
- where: 'the following parameters are used'
- scenario | dataspaceName | anchorName
- 'dataspace name' | 'dataspace names with spaces' | 'anchorName'
- 'anchor name' | 'dataspaceName' | 'anchor name with spaces'
- 'dataspace and anchor name' | 'dataspace name with spaces' | 'anchor name with spaces'
- }
-