summaryrefslogtreecommitdiffstats
path: root/examples/examples-onap-bbs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/examples-onap-bbs')
-rw-r--r--examples/examples-onap-bbs/src/main/java/org/onap/policy/apex/examples/bbs/WebClient.java3
-rw-r--r--examples/examples-onap-bbs/src/test/java/org/onap/policy/apex/examples/bbs/WebClientTest.java29
2 files changed, 16 insertions, 16 deletions
diff --git a/examples/examples-onap-bbs/src/main/java/org/onap/policy/apex/examples/bbs/WebClient.java b/examples/examples-onap-bbs/src/main/java/org/onap/policy/apex/examples/bbs/WebClient.java
index 09b3fc47b..58f07b9da 100644
--- a/examples/examples-onap-bbs/src/main/java/org/onap/policy/apex/examples/bbs/WebClient.java
+++ b/examples/examples-onap-bbs/src/main/java/org/onap/policy/apex/examples/bbs/WebClient.java
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 Huawei. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -31,11 +32,11 @@ import java.io.StringWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.nio.charset.StandardCharsets;
+import java.security.cert.X509Certificate;
import java.util.Base64;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
-import java.security.cert.X509Certificate;
import javax.net.ssl.SSLSession;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
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 b447803ef..8012c1e30 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
@@ -1,6 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2019 huawei. All rights reserved.
+ * Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,32 +21,30 @@
package org.onap.policy.apex.examples.bbs;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
import java.io.ByteArrayInputStream;
+import java.io.IOException;
import java.io.InputStream;
import javax.net.ssl.HttpsURLConnection;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mockito;
-import static org.junit.Assert.*;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
public class WebClientTest {
- HttpsURLConnection mockedHttpsURLConnection;
+ HttpsURLConnection mockedHttpsUrlConnection;
String sampleString = "Response Code :200";
/**
* Set up the mocked REST manager.
+ * @throws IOException
*/
@Before
- public void setupMockedRest() {
- mockedHttpsURLConnection = mock(HttpsURLConnection.class);
- InputStream iStream = new ByteArrayInputStream(sampleString.getBytes());
- try {
- when(mockedHttpsURLConnection.getInputStream()).thenReturn(iStream);
- Mockito.doNothing().when(mockedHttpsURLConnection).connect();
- }catch (Exception e) {
- }
-
+ public void setupMockedRest() throws IOException {
+ mockedHttpsUrlConnection = mock(HttpsURLConnection.class);
+ InputStream inputStream = new ByteArrayInputStream(sampleString.getBytes());
+ when(mockedHttpsUrlConnection.getInputStream()).thenReturn(inputStream);
+ Mockito.doNothing().when(mockedHttpsUrlConnection).connect();
}
@Test
@@ -66,8 +65,8 @@ public class WebClientTest {
@Test
public void toPrettyString() {
- String xmlSample = "<input xmlns=\"org:onap:sdnc:northbound:generic-resource\">" +
- "<sdnc-request-header> <svc-action>update</svc-action> </sdnc-request-header></input>";
+ String xmlSample = "<input xmlns=\"org:onap:sdnc:northbound:generic-resource\">"
+ + "<sdnc-request-header> <svc-action>update</svc-action> </sdnc-request-header></input>";
WebClient cl = new WebClient();
cl.toPrettyString(xmlSample, 4);
}