summaryrefslogtreecommitdiffstats
path: root/models-interactions/model-impl
diff options
context:
space:
mode:
Diffstat (limited to 'models-interactions/model-impl')
-rw-r--r--models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java31
-rw-r--r--models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/SdnrTest.java10
2 files changed, 20 insertions, 21 deletions
diff --git a/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java b/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java
index 7a2177136..78e5177b7 100644
--- a/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java
+++ b/models-interactions/model-impl/rest/src/test/java/org/onap/policy/rest/RestTest.java
@@ -3,7 +3,7 @@
* rest
* ================================================================================
* Copyright (C) 2017-2021 AT&T Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019-2020, 2023-2024 Nordix Foundation.
+ * Modifications Copyright (C) 2019-2020, 2023-2025 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,9 +22,9 @@
package org.onap.policy.rest;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
-import static org.junit.jupiter.api.Assertions.assertTrue;
import jakarta.ws.rs.Consumes;
import jakarta.ws.rs.DELETE;
@@ -104,7 +104,6 @@ public class RestTest {
/**
* Tear down server endpoint for the tests.
*
- * @throws Exception if there is a problem
*/
@AfterAll
public static void tearDown() {
@@ -112,7 +111,7 @@ public class RestTest {
}
@Test
- public void testGetUrlNull() {
+ void testGetUrlNull() {
RestManager mgr = new RestManager();
assertThrows(NullPointerException.class, () -> {
mgr.get(null, "user", null, null);
@@ -120,7 +119,7 @@ public class RestTest {
}
@Test
- public void testPutUrlNull() {
+ void testPutUrlNull() {
RestManager mgr = new RestManager();
assertThrows(NullPointerException.class, () -> {
mgr.put(null, "user", null, null, MediaType.TEXT_PLAIN, PAYLOAD);
@@ -128,7 +127,7 @@ public class RestTest {
}
@Test
- public void testPostUrlNull() {
+ void testPostUrlNull() {
RestManager mgr = new RestManager();
assertThrows(NullPointerException.class, () -> {
mgr.post(null, "user", null, null, MediaType.TEXT_PLAIN, PAYLOAD);
@@ -136,7 +135,7 @@ public class RestTest {
}
@Test
- public void testDeleteUrlNull() {
+ void testDeleteUrlNull() {
RestManager mgr = new RestManager();
assertThrows(NullPointerException.class, () -> {
mgr.delete(null, "user", null, null, null, null);
@@ -144,7 +143,7 @@ public class RestTest {
}
@Test
- public void testPatchUrlNull() {
+ void testPatchUrlNull() {
RestManager mgr = new RestManager();
assertThrows(NullPointerException.class, () -> {
mgr.patch(null, "user", null, null, PAYLOAD);
@@ -152,7 +151,7 @@ public class RestTest {
}
@Test
- public void testUsernameNull() {
+ void testUsernameNull() {
RestManager mgr = new RestManager();
Pair<Integer, String> result = mgr.get(getUri, null, null, null);
@@ -187,12 +186,12 @@ public class RestTest {
private void checkResult(Pair<Integer, String> result, String expectedText) {
assertEquals((Integer) 200, result.getLeft());
assertNotNull(result.getRight());
- assertTrue(result.getRight().length() > 0);
+ assertFalse(result.getRight().isEmpty());
assertEquals(expectedText, result.getRight());
}
@Test
- public void testUsernameEmpty() {
+ void testUsernameEmpty() {
RestManager mgr = new RestManager();
Pair<Integer, String> result = mgr.get(getUri, "", null, null);
@@ -222,7 +221,7 @@ public class RestTest {
}
@Test
- public void testGoodUrl() {
+ void testGoodUrl() {
RestManager mgr = new RestManager();
Pair<Integer, String> result = mgr.get(getUri, "user", null, null);
@@ -252,7 +251,7 @@ public class RestTest {
}
@Test
- public void testNoUrlParamUrl() {
+ void testNoUrlParamUrl() {
RestManager mgr = new RestManager();
Pair<Integer, String> result = mgr.get(baseUri + "RestTest/GetHello/", null, null, null);
@@ -274,7 +273,7 @@ public class RestTest {
}
@Test
- public void testNoQueryParamUrl() {
+ void testNoQueryParamUrl() {
RestManager mgr = new RestManager();
Pair<Integer, String> result = mgr.get(baseUri + "RestTest/GetHello/" + NAME_PARAM, null, null, null);
@@ -297,7 +296,7 @@ public class RestTest {
}
@Test
- public void testBadUrl() {
+ void testBadUrl() {
RestManager mgr = new RestManager();
Pair<Integer, String> result = mgr.get(baseUri + "NonExistant/URL/", null, null, null);
@@ -319,7 +318,7 @@ public class RestTest {
}
@Test
- public void testWrongUrl() {
+ void testWrongUrl() {
RestManager mgr = new RestManager();
Pair<Integer, String> result = mgr.get(deleteUri, null, null, null);
diff --git a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/SdnrTest.java b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/SdnrTest.java
index 3fd2cfd5b..abfd25547 100644
--- a/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/SdnrTest.java
+++ b/models-interactions/model-impl/sdnr/src/test/java/org/onap/policy/sdnr/SdnrTest.java
@@ -3,7 +3,7 @@
* sdnr
* ================================================================================
* Copyright (C) 2018 Wipro Limited Intellectual Property. All rights reserved.
- * Modifications Copyright (C) 2019, 2024 Nordix Foundation.
+ * Modifications Copyright (C) 2019, 2024-2025 Nordix Foundation.
* Modifications Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -106,7 +106,7 @@ class SdnrTest {
*/
assertTrue(jsonRequest.contains("Action"));
- logger.debug("Request as JSON: " + jsonRequest + "\n\n");
+ logger.debug("Request as JSON: {} \n\n", jsonRequest);
}
@Test
@@ -147,7 +147,7 @@ class SdnrTest {
assertNotNull(sdnrRequest.getAction());
assertEquals("ModifyConfig", sdnrRequest.getAction());
- logger.debug("Request as a Java Object: \n" + sdnrRequest.toString() + "\n\n");
+ logger.debug("Request as a Java Object:\n {} \n\n", sdnrRequest);
}
@Test
@@ -172,7 +172,7 @@ class SdnrTest {
assertTrue(jsonResponse.contains("SubRequestID"));
assertTrue(jsonResponse.contains("Status"));
- logger.debug("Response as JSON: " + jsonResponse + "\n\n");
+ logger.debug("Response as JSON: {}\n\n", jsonResponse);
}
@Test
@@ -212,6 +212,6 @@ class SdnrTest {
assertNotNull(sdnrResponse.getStatus());
assertEquals(400, sdnrResponse.getStatus().getCode());
- logger.debug("Response as a Java Object: \n" + sdnrResponse.toString() + "\n\n");
+ logger.debug("Response as a Java Object:\n {} \n\n", sdnrResponse);
}
}