summaryrefslogtreecommitdiffstats
path: root/mso-api-handlers/mso-requests-db/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'mso-api-handlers/mso-requests-db/src/test')
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/client/RequestDbClientTest.java26
1 files changed, 13 insertions, 13 deletions
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/client/RequestDbClientTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/client/RequestDbClientTest.java
index 0ad8d1458e..32886bf62e 100644
--- a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/client/RequestDbClientTest.java
+++ b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/db/request/client/RequestDbClientTest.java
@@ -1,11 +1,14 @@
package org.onap.so.db.request.client;
+import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.when;
import java.net.URI;
+import java.util.ArrayList;
+import java.util.List;
import javax.ws.rs.core.UriBuilder;
-import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
@@ -13,21 +16,14 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.logging.filter.spring.SpringClientPayloadFilter;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.beans.RequestProcessingData;
-import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
-import org.springframework.beans.factory.annotation.Value;
+import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
-import org.springframework.http.client.BufferingClientHttpRequestFactory;
-import org.springframework.http.client.ClientHttpRequestFactory;
-import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
-import uk.co.blackpepper.bowman.ClientFactory;
-import uk.co.blackpepper.bowman.Configuration;
@RunWith(MockitoJUnitRunner.class)
@@ -61,12 +57,16 @@ public class RequestDbClientTest {
@Test
public void testGetRequestProcessingDataBySoRequestIdAndIsInternalData() {
Mockito.doReturn("host").when(requestsDbClient).getEndpoint();
- requestsDbClient.getExternalRequestProcessingDataBySoRequestId("12345");
URI uri = URI.create(UriBuilder
.fromUri("host/requestProcessingData/search/findBySoRequestIdAndIsDataInternalOrderByGroupingIdDesc")
.queryParam("SO_REQUEST_ID", "12345").queryParam("IS_INTERNAL_DATA", false).build().toString());
- Mockito.verify(restTemplate, times(1)).exchange(eq(uri), eq(HttpMethod.GET), isA(HttpEntity.class),
- eq(RequestProcessingData[].class));
+ when(restTemplate.exchange(eq(uri), eq(HttpMethod.GET), isA(HttpEntity.class),
+ isA(ParameterizedTypeReference.class))).thenReturn(
+ new ResponseEntity<List<RequestProcessingData>>(new ArrayList<RequestProcessingData>(),
+ HttpStatus.NOT_FOUND));
+ assertTrue(requestsDbClient.getExternalRequestProcessingDataBySoRequestId("12345").isEmpty());
+
+
}
}