one more case added in DmaapClientUtilTest.java
Change-Id: Ifaa597832166063a16f5b27c5cc9ad390dbe41b1
Issue-ID: DMAAP-838
Signed-off-by: Mohamed Asgar Samiulla <sammoham@in.ibm.com>
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 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 @@
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);
+ }