+ def 'when createAnchor API is called, the response status is 201. '() {
+ given:
+ def requestParams = new LinkedMultiValueMap<>()
+ requestParams.add('schema-set-name', 'my_schema-set')
+ requestParams.add('anchor-name', 'my_anchor')
+ when: 'post is invoked'
+ def response = mvc.perform(post(anchorsEndpoint).contentType(MediaType.APPLICATION_JSON)
+ .params(requestParams as MultiValueMap)).andReturn().response
+ then: 'Status is 201 and the response is the name of the created anchor -> my_anchor'
+ 1 * mockCpsAdminService.createAnchor('my_dataspace', 'my_schema-set', 'my_anchor')
+ assert response.status == HttpStatus.CREATED.value()
+ assert response.getContentAsString().contains('my_anchor')
+ }
+
+ def 'when get all anchors for a dataspace API is called, the response status is 200 '() {
+ given:
+ mockCpsAdminService.getAnchors('my_dataspace') >> anchorList
+ when: 'get all anchors API is invoked'
+ def response = mvc.perform(get(anchorsEndpoint)).andReturn().response
+ then: 'Status is 200 and the response is Collection of Anchors containing anchor name -> my_anchor'
+ assert response.status == HttpStatus.OK.value()
+ assert response.getContentAsString().contains('my_anchor')
+ }