aboutsummaryrefslogtreecommitdiffstats
path: root/examples/examples-onap-bbs/src/test/java
diff options
context:
space:
mode:
authorliamfallon <liam.fallon@est.tech>2019-06-27 14:58:28 +0000
committerliamfallon <liam.fallon@est.tech>2019-06-27 14:58:28 +0000
commitfad6fa4890538fe8f4cbb96ae3fb0be6767d28d1 (patch)
tree34ef945b70297b5bd2171cf84d8b3c700a704830 /examples/examples-onap-bbs/src/test/java
parent5f029543f1e673655af2d2974113069df0b6def0 (diff)
Fix Sonar/Checkstyle issues in apex-pdp
BBS Java code introduced Sonar issues, these are resolved. Also fixed checkstyle errors in other classes. Also fiexed "unexpected type" eclipse errors. Issue-ID: POLICY-1791 Change-Id: I3931051f0944c6d53745c8dd1db7cca4ee118f1c Signed-off-by: liamfallon <liam.fallon@est.tech>
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