summaryrefslogtreecommitdiffstats
path: root/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy')
-rw-r--r--src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy b/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy
index 6d9445c1..e2621e47 100644
--- a/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy
+++ b/src/test/groovy/org/onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy
@@ -22,6 +22,7 @@ package org.onap.cps.ncmp.dmi.service.client
import org.onap.cps.ncmp.dmi.config.DmiConfiguration
import org.springframework.http.HttpEntity
+import org.springframework.http.HttpHeaders
import org.springframework.http.ResponseEntity
import org.springframework.web.client.RestTemplate
import spock.lang.Specification
@@ -64,6 +65,20 @@ class SdncRestconfClientSpec extends Specification {
result == mockResponseEntity
}
+ def 'SDNC GET operation with header.'() {
+ given: 'a get url'
+ def getResourceUrl = '/getResourceUrl'
+ and: 'sdnc properties'
+ setupTestConfigurationData()
+ and: 'the rest template returns a valid response entity'
+ def mockResponseEntity = Mock(ResponseEntity)
+ mockRestTemplate.getForEntity({ it.toString() == 'http://some-uri/getResourceUrl' }, String.class, _ as HttpEntity) >> mockResponseEntity
+ when: 'GET operation is invoked'
+ def result = objectUnderTest.getOperation(getResourceUrl, new HttpHeaders())
+ then: 'the output of the method is equal to the output from the test template'
+ result == mockResponseEntity
+ }
+
def setupTestConfigurationData() {
mockSdncProperties.baseUrl >> 'http://some-uri'
mockSdncProperties.authUsername >> 'some-username'