aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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);
+ }