aboutsummaryrefslogtreecommitdiffstats
path: root/main/src/test/java/org/onap
diff options
context:
space:
mode:
authorJim Hahn <jrh3@att.com>2020-06-29 12:14:07 -0400
committerJim Hahn <jrh3@att.com>2020-06-29 12:43:12 -0400
commit57c87591cde427a672dcbeb17f17eb06fbdeca1c (patch)
treed6a9fa1c0958372dd269589924585730ae5795a5 /main/src/test/java/org/onap
parent2521a4a50b3496d9356f318c67cacb511e485de4 (diff)
Fix issues in api for new sonar rules
Addressed issues reported due to updates to the sonar rules: - use assertEquals, assertNull, etc. - use "<>" - use "{}" place-holder Issue-ID: POLICY-2680 Change-Id: I42d5e635e09bac6e520fc7aa386814ad617fc1f6 Signed-off-by: Jim Hahn <jrh3@att.com>
Diffstat (limited to 'main/src/test/java/org/onap')
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/TestCommonRestController.java6
-rw-r--r--main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java3
-rw-r--r--main/src/test/java/org/onap/policy/api/main/startstop/TestMain.java9
3 files changed, 9 insertions, 9 deletions
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/TestCommonRestController.java b/main/src/test/java/org/onap/policy/api/main/rest/TestCommonRestController.java
index 68377003..dc921488 100644
--- a/main/src/test/java/org/onap/policy/api/main/rest/TestCommonRestController.java
+++ b/main/src/test/java/org/onap/policy/api/main/rest/TestCommonRestController.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP Policy API
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,7 +24,7 @@
package org.onap.policy.api.main.rest;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.assertSame;
import java.util.UUID;
import javax.ws.rs.core.Response;
@@ -42,7 +42,7 @@ public class TestCommonRestController {
UUID requestId = UUID.randomUUID();
ResponseBuilder rb =
crc.addLoggingHeaders(crc.addVersionControlHeaders(Response.status(Response.Status.OK)), requestId);
- assertTrue(rb.equals(rb.header("X-ONAP-RequestID", requestId)));
+ assertSame(rb, rb.header("X-ONAP-RequestID", requestId));
}
/*
diff --git a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java
index bb4eca95..c91d8adc 100644
--- a/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java
+++ b/main/src/test/java/org/onap/policy/api/main/rest/provider/TestLegacyOperationalPolicyProvider.java
@@ -26,7 +26,6 @@ package org.onap.policy.api.main.rest.provider;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
@@ -222,7 +221,7 @@ public class TestLegacyOperationalPolicyProvider {
operationalPolicyProvider.createOperationalPolicy(policyToCreate);
assertEquals("operational.restart", policyCreated.getPolicyId());
assertEquals("1", policyCreated.getPolicyVersion());
- assertFalse(policyCreated.getContent() == null);
+ assertNotNull(policyCreated.getContent());
}).doesNotThrowAnyException();
// Test fetchDeployedPolicies (deployedPolicyMap.isEmpty())==true
diff --git a/main/src/test/java/org/onap/policy/api/main/startstop/TestMain.java b/main/src/test/java/org/onap/policy/api/main/startstop/TestMain.java
index 60222f6d..90397755 100644
--- a/main/src/test/java/org/onap/policy/api/main/startstop/TestMain.java
+++ b/main/src/test/java/org/onap/policy/api/main/startstop/TestMain.java
@@ -1,7 +1,7 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2018 Samsung Electronics Co., Ltd. All rights reserved.
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,6 +23,7 @@ package org.onap.policy.api.main.startstop;
import static org.assertj.core.api.Assertions.assertThatCode;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
@@ -51,14 +52,14 @@ public class TestMain {
public void testMain_NoArguments() {
final String[] apiConfigParameters = {};
final Main main = new Main(apiConfigParameters);
- assertTrue(main.getParameters() == null);
+ assertNull(main.getParameters());
}
@Test
public void testMain_InvalidArguments() {
final String[] apiConfigParameters = {"parameters/ApiConfigParameters.json"};
final Main main = new Main(apiConfigParameters);
- assertTrue(main.getParameters() == null);
+ assertNull(main.getParameters());
}
@Test
@@ -71,6 +72,6 @@ public class TestMain {
public void testMain_InvalidParameters() {
final String[] apiConfigParameters = {"-c", "parameters/ApiConfigParameters_InvalidName.json"};
final Main main = new Main(apiConfigParameters);
- assertTrue(main.getParameters() == null);
+ assertNull(main.getParameters());
}
}