From 11e9f72aa953516053d867e09a0e95c77d7d1a88 Mon Sep 17 00:00:00 2001 From: tragait Date: Fri, 27 Aug 2021 15:01:27 +0100 Subject: fix getforentity in onap DMI plugin Issue-ID: CPS-573 Signed-off-by: tragait Change-Id: Idb2186e6f3275530513bbd5e788c98b4ceda9d10 --- .../onap/cps/ncmp/dmi/service/client/SdncRestconfClientSpec.groovy | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/test/groovy') 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 9a7ed180..b550480d 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 @@ -23,6 +23,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.HttpMethod import org.springframework.http.ResponseEntity import org.springframework.web.client.RestTemplate import spock.lang.Specification @@ -40,7 +41,8 @@ class SdncRestconfClientSpec extends Specification { 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 + mockRestTemplate.exchange({ it.toString() == 'http://some-uri/getResourceUrl' }, + HttpMethod.GET, _ as HttpEntity, String.class) >> mockResponseEntity when: 'GET operation is invoked' def result = objectUnderTest.getOperation(getResourceUrl) then: 'the output of the method is equal to the output from the test template' @@ -72,7 +74,8 @@ class SdncRestconfClientSpec extends Specification { 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 + mockRestTemplate.exchange({ it.toString() == 'http://some-uri/getResourceUrl' }, + HttpMethod.GET, _ as HttpEntity, String.class) >> 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' -- cgit 1.2.3-korg