restAdaptor unit test cases added 92/128792/1
authorGanesh <ganesh.c@samsung.com>
Fri, 22 Apr 2022 11:03:54 +0000 (16:33 +0530)
committerGanesh <ganesh.c@samsung.com>
Fri, 22 Apr 2022 11:04:04 +0000 (16:34 +0530)
Signed-off-by: Ganesh <ganesh.c@samsung.com>
Change-Id: I918cac94debd551601582207e29f819128ba7845
Issue-ID: CCSDK-3476

adaptors/rest-adaptor/rest-adaptor-bundle/src/test/java/org/onap/ccsdk/sli/adaptors/rest/impl/RequestFactoryTest.java

index e5c5ed1..8b1b23a 100644 (file)
@@ -46,6 +46,38 @@ import static org.junit.Assert.assertTrue;
 
 public class RequestFactoryTest {
 
+    @Test
+    public void testGetHttpRequestGet() throws Exception {
+        RequestFactory httpRequest = new RequestFactory();
+        HttpRequestBase get = httpRequest.getHttpRequest("get", "http://test/url.com");
+        assertEquals(get.getMethod(), "GET");
+        assertEquals(get.getURI().toString(), "http://test/url.com");
+    }
+
+    @Test
+    public void testGetHttpRequestPost() throws Exception {
+        RequestFactory httpRequest = new RequestFactory();
+        HttpRequestBase get = httpRequest.getHttpRequest("post", "http://test/url.com");
+        assertEquals(get.getMethod(), "POST");
+        assertEquals(get.getURI().toString(), "http://test/url.com");
+    }
+
+    @Test
+    public void testGetHttpRequestPut() throws Exception {
+        RequestFactory httpRequest = new RequestFactory();
+        HttpRequestBase get = httpRequest.getHttpRequest("put", "http://test/url.com");
+        assertEquals(get.getMethod(), "PUT");
+        assertEquals(get.getURI().toString(), "http://test/url.com");
+    }
+
+    @Test
+    public void testGetHttpRequestDelete() throws Exception {
+        RequestFactory httpRequest = new RequestFactory();
+        HttpRequestBase get = httpRequest.getHttpRequest("delete", "http://test/url.com");
+        assertEquals(get.getMethod(), "DELETE");
+        assertEquals(get.getURI().toString(), "http://test/url.com");
+    }
+
     @Test
     public void testConstructorNoArgument() throws Exception {
         RequestFactory httpRequest = new RequestFactory();