Clean up of Pair classes - drools-pdp
[policy/drools-pdp.git] / feature-pooling-dmaap / src / test / java / org / onap / policy / drools / pooling / state / QueryStateTest.java
index 97c9c95..aa999b5 100644 (file)
@@ -3,13 +3,14 @@
  * ONAP
  * ================================================================================
  * Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2020 Nordix Foundation
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -32,6 +33,7 @@ import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 import java.util.Map;
+import org.apache.commons.lang3.tuple.Pair;
 import org.junit.Before;
 import org.junit.Test;
 import org.onap.policy.drools.pooling.message.BucketAssignments;
@@ -39,7 +41,6 @@ import org.onap.policy.drools.pooling.message.Identification;
 import org.onap.policy.drools.pooling.message.Leader;
 import org.onap.policy.drools.pooling.message.Message;
 import org.onap.policy.drools.pooling.message.Offline;
-import org.onap.policy.drools.utils.Pair;
 
 public class QueryStateTest extends SupportBasicStateTester {
 
@@ -48,6 +49,7 @@ public class QueryStateTest extends SupportBasicStateTester {
     /**
      * Setup.
      */
+    @Override
     @Before
     public void setUp() throws Exception {
         super.setUp();
@@ -77,8 +79,8 @@ public class QueryStateTest extends SupportBasicStateTester {
 
         Pair<Long, StateTimerTask> timer = onceTasks.remove();
 
-        assertEquals(STD_IDENTIFICATION_MS, timer.first().longValue());
-        assertNotNull(timer.second());
+        assertEquals(STD_IDENTIFICATION_MS, timer.getLeft().longValue());
+        assertNotNull(timer.getRight());
     }
 
     @Test
@@ -251,15 +253,15 @@ public class QueryStateTest extends SupportBasicStateTester {
 
         Pair<Long, StateTimerTask> timer = onceTasks.remove();
 
-        assertEquals(STD_IDENTIFICATION_MS, timer.first().longValue());
-        assertNotNull(timer.second());
+        assertEquals(STD_IDENTIFICATION_MS, timer.getLeft().longValue());
+        assertNotNull(timer.getRight());
 
         // should published an Offline message and go inactive
 
         State next = mock(State.class);
         when(mgr.goStart()).thenReturn(next);
 
-        assertEquals(next, timer.second().fire());
+        assertEquals(next, timer.getRight().fire());
 
         // should continue distributing
         verify(mgr, never()).startDistributing(null);
@@ -275,13 +277,13 @@ public class QueryStateTest extends SupportBasicStateTester {
 
         Pair<Long, StateTimerTask> timer = onceTasks.remove();
 
-        assertEquals(STD_IDENTIFICATION_MS, timer.first().longValue());
-        assertNotNull(timer.second());
+        assertEquals(STD_IDENTIFICATION_MS, timer.getLeft().longValue());
+        assertNotNull(timer.getRight());
 
         State next = mock(State.class);
         when(mgr.goActive()).thenReturn(next);
 
-        assertEquals(next, timer.second().fire());
+        assertEquals(next, timer.getRight().fire());
 
         // should have published a Leader message
         Leader msg = captureAdminMessage(Leader.class);
@@ -304,14 +306,14 @@ public class QueryStateTest extends SupportBasicStateTester {
 
         Pair<Long, StateTimerTask> timer = onceTasks.remove();
 
-        assertEquals(STD_IDENTIFICATION_MS, timer.first().longValue());
-        assertNotNull(timer.second());
+        assertEquals(STD_IDENTIFICATION_MS, timer.getLeft().longValue());
+        assertNotNull(timer.getRight());
 
         // set up active state, as that's what it should return
         State next = mock(State.class);
         when(mgr.goActive()).thenReturn(next);
 
-        assertEquals(next, timer.second().fire());
+        assertEquals(next, timer.getRight().fire());
 
         // should NOT have published a Leader message
         assertTrue(admin.isEmpty());
@@ -335,14 +337,14 @@ public class QueryStateTest extends SupportBasicStateTester {
 
         Pair<Long, StateTimerTask> timer = onceTasks.remove();
 
-        assertEquals(STD_IDENTIFICATION_MS, timer.first().longValue());
-        assertNotNull(timer.second());
+        assertEquals(STD_IDENTIFICATION_MS, timer.getLeft().longValue());
+        assertNotNull(timer.getRight());
 
         // set up inactive state, as that's what it should return
         State next = mock(State.class);
         when(mgr.goInactive()).thenReturn(next);
 
-        assertEquals(next, timer.second().fire());
+        assertEquals(next, timer.getRight().fire());
 
         // should NOT have published a Leader message
         assertTrue(admin.isEmpty());