aboutsummaryrefslogtreecommitdiffstats
path: root/examples/examples-onap-bbs/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'examples/examples-onap-bbs/src/test/java')
-rw-r--r--examples/examples-onap-bbs/src/test/java/org/onap/policy/apex/examples/bbs/WebClientTest.java19
1 files changed, 11 insertions, 8 deletions
diff --git a/examples/examples-onap-bbs/src/test/java/org/onap/policy/apex/examples/bbs/WebClientTest.java b/examples/examples-onap-bbs/src/test/java/org/onap/policy/apex/examples/bbs/WebClientTest.java
index 8012c1e30..2ff9435b2 100644
--- a/examples/examples-onap-bbs/src/test/java/org/onap/policy/apex/examples/bbs/WebClientTest.java
+++ b/examples/examples-onap-bbs/src/test/java/org/onap/policy/apex/examples/bbs/WebClientTest.java
@@ -21,6 +21,7 @@
package org.onap.policy.apex.examples.bbs;
+import static org.junit.Assert.assertNotNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -35,13 +36,15 @@ import org.mockito.Mockito;
public class WebClientTest {
HttpsURLConnection mockedHttpsUrlConnection;
String sampleString = "Response Code :200";
+
/**
* Set up the mocked REST manager.
- * @throws IOException
+ *
+ * @throws IOException on I/O errors
*/
@Before
public void setupMockedRest() throws IOException {
- mockedHttpsUrlConnection = mock(HttpsURLConnection.class);
+ mockedHttpsUrlConnection = mock(HttpsURLConnection.class);
InputStream inputStream = new ByteArrayInputStream(sampleString.getBytes());
when(mockedHttpsUrlConnection.getInputStream()).thenReturn(inputStream);
Mockito.doNothing().when(mockedHttpsUrlConnection).connect();
@@ -50,17 +53,17 @@ public class WebClientTest {
@Test
public void httpsRequest() {
WebClient cl = new WebClient();
- String result = cl.httpsRequest("https://some.random.url/data", "POST", null,
- "admin", "admin", "application/json",true, true);
-
+ String result = cl.httpRequest("https://some.random.url/data", "POST", null, "admin", "admin",
+ "application/json", true);
+ assertNotNull(result);
}
@Test
public void httpRequest() {
WebClient cl = new WebClient();
- String result = cl.httpRequest("http://some.random.url/data", "GET", null,
- "admin", "admin", "application/json",true, true);
-
+ String result =
+ cl.httpRequest("http://some.random.url/data", "GET", null, "admin", "admin", "application/json", false);
+ assertNotNull(result);
}
@Test