Removing deprecated DMAAP library
[policy/drools-pdp.git] / feature-pooling-messages / src / test / java / org / onap / policy / drools / pooling / message / BucketAssignmentsTest.java
@@ -3,6 +3,7 @@
  * ONAP
  * ================================================================================
  * Copyright (C) 2018, 2020 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2024 Nordix Foundation.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 package org.onap.policy.drools.pooling.message;
 
 import static org.assertj.core.api.Assertions.assertThatCode;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertFalse;
+import static org.junit.jupiter.api.Assertions.assertNotEquals;
+import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
+import static org.junit.jupiter.api.Assertions.fail;
 
 import java.util.Arrays;
 import java.util.SortedSet;
 import java.util.TreeSet;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 import org.onap.policy.drools.pooling.PoolingFeatureException;
 
-public class BucketAssignmentsTest {
+class BucketAssignmentsTest {
 
     @Test
-    public void testBucketAssignments() {
-        assertThatCode(() -> new BucketAssignments()).doesNotThrowAnyException();
+    void testBucketAssignments() {
+        assertThatCode(BucketAssignments::new).doesNotThrowAnyException();
     }
 
     @Test
-    public void testBucketAssignmentsStringArray() {
+    void testBucketAssignmentsStringArray() {
         String[] arr = {"abc", "def"};
         BucketAssignments asgn = new BucketAssignments(arr);
 
         assertNotNull(asgn.getHostArray());
-        assertEquals(arr.toString(), asgn.getHostArray().toString());
+        assertEquals(Arrays.toString(arr), Arrays.toString(asgn.getHostArray()));
     }
 
     @Test
-    public void testGetHostArray_testSetHostArray() {
+    void testGetHostArray_testSetHostArray() {
 
         String[] arr = {"abc", "def"};
         BucketAssignments asgn = new BucketAssignments(arr);
 
         assertNotNull(asgn.getHostArray());
-        assertEquals(arr.toString(), asgn.getHostArray().toString());
+        assertEquals(Arrays.toString(arr), Arrays.toString(asgn.getHostArray()));
 
         String[] arr2 = {"xyz"};
         asgn.setHostArray(arr2);
 
         assertNotNull(asgn.getHostArray());
-        assertEquals(arr2.toString(), asgn.getHostArray().toString());
+        assertEquals(Arrays.toString(arr2), Arrays.toString(asgn.getHostArray()));
     }
 
     @Test
-    public void testGetLeader() {
+    void testGetLeader() {
         // host array is null
         BucketAssignments asgn = new BucketAssignments();
         assertNull(asgn.getLeader());
@@ -107,7 +108,7 @@ public class BucketAssignmentsTest {
     }
 
     @Test
-    public void testHasAssignment() {
+    void testHasAssignment() {
         // host array is null
         BucketAssignments asgn = new BucketAssignments();
         assertFalse(asgn.hasAssignment("abc"));
@@ -146,7 +147,7 @@ public class BucketAssignmentsTest {
     }
 
     @Test
-    public void testGetAllHosts() {
+    void testGetAllHosts() {
         // host array is null
         BucketAssignments asgn = new BucketAssignments();
         assertEquals("[]", getSortedHosts(asgn).toString());
@@ -183,7 +184,7 @@ public class BucketAssignmentsTest {
     }
 
     @Test
-    public void testGetAssignedHost() {
+    void testGetAssignedHost() {
         // host array is null
         BucketAssignments asgn = new BucketAssignments();
         assertNull(asgn.getAssignedHost(3));
@@ -218,7 +219,7 @@ public class BucketAssignmentsTest {
     }
 
     @Test
-    public void testSize() {
+    void testSize() {
         // host array is null
         BucketAssignments asgn = new BucketAssignments();
         assertEquals(0, asgn.size());
@@ -238,7 +239,7 @@ public class BucketAssignmentsTest {
     }
 
     @Test
-    public void testCheckValidity() throws Exception {
+    void testCheckValidity() throws Exception {
         // host array is null
         BucketAssignments asgn = new BucketAssignments();
         expectException(asgn);
@@ -277,7 +278,7 @@ public class BucketAssignmentsTest {
     }
 
     @Test
-    public void testHashCode() {
+    void testHashCode() {
         // with null assignments
         BucketAssignments asgn = new BucketAssignments();
         asgn.hashCode();
@@ -303,10 +304,10 @@ public class BucketAssignmentsTest {
     }
 
     @Test
-    public void testEquals() {
+    void testEquals() {
         // null object
         BucketAssignments asgn = new BucketAssignments();
-        assertNotEquals(asgn, null);
+        assertNotEquals(null, asgn);
 
         // same object
         asgn = new BucketAssignments();
@@ -314,7 +315,7 @@ public class BucketAssignmentsTest {
 
         // different class of object
         asgn = new BucketAssignments();
-        assertNotEquals(asgn, "not an assignment object");
+        assertNotEquals("not an assignment object", asgn);
 
         assertNotEquals(asgn, new BucketAssignments(new String[] {"abc"}));