From ba74ddd3f92adda66235846363a093d8211fdda1 Mon Sep 17 00:00:00 2001 From: Ganesh Date: Fri, 22 Apr 2022 16:33:54 +0530 Subject: restAdaptor unit test cases added Signed-off-by: Ganesh Change-Id: I918cac94debd551601582207e29f819128ba7845 Issue-ID: CCSDK-3476 --- .../sli/adaptors/rest/impl/RequestFactoryTest.java | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'adaptors/rest-adaptor') diff --git a/adaptors/rest-adaptor/rest-adaptor-bundle/src/test/java/org/onap/ccsdk/sli/adaptors/rest/impl/RequestFactoryTest.java b/adaptors/rest-adaptor/rest-adaptor-bundle/src/test/java/org/onap/ccsdk/sli/adaptors/rest/impl/RequestFactoryTest.java index e5c5ed15e..8b1b23acf 100644 --- a/adaptors/rest-adaptor/rest-adaptor-bundle/src/test/java/org/onap/ccsdk/sli/adaptors/rest/impl/RequestFactoryTest.java +++ b/adaptors/rest-adaptor/rest-adaptor-bundle/src/test/java/org/onap/ccsdk/sli/adaptors/rest/impl/RequestFactoryTest.java @@ -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(); -- cgit 1.2.3-korg