aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/org/onap/aai/restclient/client/RestfulClientTest.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java/org/onap/aai/restclient/client/RestfulClientTest.java')
-rw-r--r--src/test/java/org/onap/aai/restclient/client/RestfulClientTest.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/test/java/org/onap/aai/restclient/client/RestfulClientTest.java b/src/test/java/org/onap/aai/restclient/client/RestfulClientTest.java
index 0e5c84e..1f528ae 100644
--- a/src/test/java/org/onap/aai/restclient/client/RestfulClientTest.java
+++ b/src/test/java/org/onap/aai/restclient/client/RestfulClientTest.java
@@ -28,6 +28,7 @@ import javax.ws.rs.core.Response.Status;
import org.junit.Before;
import org.junit.Test;
+import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
import org.onap.aai.restclient.client.OperationResult;
import org.onap.aai.restclient.client.RestClient;
@@ -167,6 +168,31 @@ public class RestfulClientTest {
assertNull(result.getResult());
assertNull(result.getFailureCause());
}
+
+ @Test
+ public void validateSuccessfulPost_withMultivaluedHeader() throws Exception {
+ RestClient restClient = buildClient();
+
+ MultivaluedMapImpl headerMap = new MultivaluedMapImpl();
+
+ headerMap.add("txnId", "123");
+ headerMap.add("txnId", "456");
+ headerMap.add("txnId", "789");
+
+ OperationResult result = restClient.post(TEST_URL, "", headerMap, MediaType.APPLICATION_JSON_TYPE,
+ MediaType.APPLICATION_JSON_TYPE);
+
+ // capture the txnId header from the outgoing request
+ ArgumentCaptor<String> txnIdHeaderName = ArgumentCaptor.forClass(String.class);
+ ArgumentCaptor<String> txnIdHeaderValue = ArgumentCaptor.forClass(String.class);
+
+ Mockito.verify(mockedBuilder, Mockito.atLeast(1)).header(txnIdHeaderName.capture(), txnIdHeaderValue.capture());
+ assertEquals("123;456;789", txnIdHeaderValue.getValue());
+
+ assertEquals(Response.Status.OK.getStatusCode(), result.getResultCode());
+ assertNotNull(result.getResult());
+ assertNull(result.getFailureCause());
+ }
@Test
public void validateSuccessfulGet() throws Exception {