aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java
diff options
context:
space:
mode:
authorasgar <sammoham@in.ibm.com>2018-10-08 20:14:31 +0530
committerasgar <sammoham@in.ibm.com>2018-10-08 20:14:37 +0530
commit9775bb11c919b0a8d89d81abf1b1a76bb7592f78 (patch)
treeed0f6c3317d9555aa01e6af99d8bd53e9022369a /src/test/java
parente124aeeb689db8959f6dbee88402624ff5ea3f20 (diff)
one more case added in DmaapClientUtilTest.java
Change-Id: Ifaa597832166063a16f5b27c5cc9ad390dbe41b1 Issue-ID: DMAAP-838 Signed-off-by: Mohamed Asgar Samiulla <sammoham@in.ibm.com>
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/com/att/nsa/mr/client/impl/DMaapClientUtilTest.java29
1 files changed, 28 insertions, 1 deletions
diff --git a/src/test/java/com/att/nsa/mr/client/impl/DMaapClientUtilTest.java b/src/test/java/com/att/nsa/mr/client/impl/DMaapClientUtilTest.java
index 569a5f0..9841adb 100644
--- a/src/test/java/com/att/nsa/mr/client/impl/DMaapClientUtilTest.java
+++ b/src/test/java/com/att/nsa/mr/client/impl/DMaapClientUtilTest.java
@@ -26,22 +26,37 @@ import static org.junit.Assert.assertEquals;
import java.io.IOException;
import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.client.Invocation;
+import javax.ws.rs.client.Invocation.Builder;
import javax.ws.rs.client.WebTarget;
+import javax.ws.rs.core.Response;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
+import com.att.aft.dme2.internal.jersey.core.spi.factory.ResponseImpl;
+
public class DMaapClientUtilTest {
+ Builder builder;
+
+ Response response;
+
+ WebTarget target;
+
@Before
public void setup(){
Mockito.mock(HttpServletRequest.class);
+ builder = Mockito.mock(Invocation.Builder.class);
+ response = Mockito.mock(Response.class);
+ target = Mockito.mock(WebTarget.class);
+
}
@Test
public void testGetTarget() throws IOException{
- WebTarget actual = DmaapClientUtil.getTarget("testpath");
+ WebTarget actual = DmaapClientUtil.getTarget("testpath");
assertEquals("testpath", actual.getUri().getPath());
}
@@ -52,6 +67,18 @@ public class DMaapClientUtilTest {
assertEquals("testpath", actual.getUri().getPath());
}
+
+ @Test
+ public void testGetResponsewtCambriaAuth() {
+ Mockito.when(target.request()).thenReturn(builder);
+ Mockito.when(builder.header("X-CambriaAuth", "testuser")).thenReturn(builder);
+ Mockito.when(builder.header("X-CambriaDate", "testpassword")).thenReturn(builder);
+ Mockito.when(builder.get()).thenReturn(response);
+
+ Response actual = DmaapClientUtil.getResponsewtCambriaAuth(target, "testuser", "testpassword");
+
+ assertEquals(response, actual);
+ }