aboutsummaryrefslogtreecommitdiffstats
path: root/examples/examples-onap-bbs/src/test/java
diff options
context:
space:
mode:
authora.sreekumar <ajith.sreekumar@est.tech>2019-06-20 09:39:59 +0000
committera.sreekumar <ajith.sreekumar@est.tech>2019-06-20 09:39:59 +0000
commit0fbf039020488215008a2c1fef8a7801bade9177 (patch)
tree04187de83d54715d49d8fc4ba24bb92fc7e55523 /examples/examples-onap-bbs/src/test/java
parent7b945416da394a3ae3e53a1a9ae8d21f6a4e761e (diff)
Enable maven-checkstyle-plugin in apex-pdp
Enable maven-checkstyle-plugin in apex-pdp/pom.xml to fail the build at warning level. Fix all the existing check style issues in the component. Change-Id: I4de9c1bd9ca5a2876de9086d2d3526cbdc25c080 Issue-ID: POLICY-1732 Signed-off-by: a.sreekumar <ajith.sreekumar@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.java29
1 files changed, 14 insertions, 15 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 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);
}