Fix findbug and checkstyle issues
[bgpcep.git] / bgp / path-selection-mode / src / test / java / org / opendaylight / protocol / bgp / mode / impl / add / n / paths / SimpleRouteEntryTest.java
index 8a9892e2b8cd3b00a6c6ab25ea1c341aadaaef6f..e941a17dd91d9b7494e860dba130f5d0a343ca77 100644 (file)
@@ -12,8 +12,6 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import java.util.Map;
-import java.util.function.Function;
-import java.util.stream.Collectors;
 import org.junit.Before;
 import org.junit.Test;
 import org.opendaylight.protocol.bgp.mode.impl.AbstractRouteEntryTest;
@@ -45,17 +43,20 @@ public final class SimpleRouteEntryTest extends AbstractRouteEntryTest {
     }
 
     private void testWriteEmptyBestPath() {
-        this.testBARE.writeRoute(PEER_ID, ROUTE_ID_PA, PEER_YII2, this.peg, TABLES_KEY, this.peerPT, this.ribSupport, this.tx);
-        assertEquals(0, this.yIIChanges.size());
+        this.testBARE.writeRoute(PEER_ID, ROUTE_ID_PA, PEER_YII2, this.peg, TABLES_KEY, this.peerPT, this.ribSupport,
+                this.tx);
+        assertEquals(0, this.yiichanges.size());
     }
 
     private void testAddRouteSelectBestAndWriteOnDS() {
-        this.testBARE.addRoute(ROUTER_ID, REMOTE_PATH_ID, this.ribSupport.routeAttributesIdentifier(), this.attributes);
+        this.testBARE.addRoute(ROUTER_ID, REMOTE_PATH_ID, this.ribSupport.routeAttributesIdentifier(),
+                this.attributes);
         assertFalse(this.testBARE.isEmpty());
         assertTrue(this.testBARE.selectBest(AS));
         /** Add AddPath Route **/
-        this.testBARE.updateRoute(TABLES_KEY, this.peerPT, LOC_RIB_TARGET, this.ribSupport, this.tx, ROUTE_ID_PA_ADD_PATH);
-        Map<YangInstanceIdentifier, Long> yiiCount = this.yIIChanges.stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
+        this.testBARE.updateRoute(TABLES_KEY, this.peerPT, LOC_RIB_TARGET, this.ribSupport, this.tx,
+                ROUTE_ID_PA_ADD_PATH);
+        final Map<YangInstanceIdentifier, Long> yiiCount = collectInfo();
         assertEquals(3, yiiCount.size());
         assertEquals(1, (long) yiiCount.get(this.routePaAddPathYii));
         assertEquals(1, (long) yiiCount.get(this.routeAddRiboutYii));
@@ -68,23 +69,24 @@ public final class SimpleRouteEntryTest extends AbstractRouteEntryTest {
     }
 
     private void testInitializePeerWithExistentRoute() {
-        assertEquals(3, this.yIIChanges.size());
-        this.testBARE.writeRoute(PEER_ID, ROUTE_ID_PA_ADD_PATH, PEER_YII2, this.peg, TABLES_KEY, this.peerPT, this.ribSupport, this.tx);
-        assertEquals(5, this.yIIChanges.size());
-        final Map<YangInstanceIdentifier, Long> yiiCount = this.yIIChanges.stream()
-            .collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
+        assertEquals(3, this.yiichanges.size());
+        this.testBARE.writeRoute(PEER_ID, ROUTE_ID_PA_ADD_PATH, PEER_YII2, this.peg, TABLES_KEY, this.peerPT,
+                this.ribSupport, this.tx);
+        assertEquals(5, this.yiichanges.size());
+        final Map<YangInstanceIdentifier, Long> yiiCount = collectInfo();
         assertEquals(1, (long) yiiCount.get(this.routeAddRiboutYiiPeer2));
         assertEquals(1, (long) yiiCount.get(this.routeAddRiboutYiiPeer2));
     }
 
     private void testRemoveRoute() {
-        Map<YangInstanceIdentifier, Long> yiiCount = this.yIIChanges.stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
+        Map<YangInstanceIdentifier, Long> yiiCount = collectInfo();
         assertEquals(5, yiiCount.size());
         assertEquals(1, (long) yiiCount.get(this.routePaAddPathYii));
         assertTrue(this.testBARE.removeRoute(ROUTER_ID, REMOTE_PATH_ID));
         assertTrue(this.testBARE.selectBest(AS));
-        this.testBARE.updateRoute(TABLES_KEY, this.peerPT, LOC_RIB_TARGET, this.ribSupport, this.tx, ROUTE_ID_PA_ADD_PATH);
-        yiiCount = this.yIIChanges.stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting()));
+        this.testBARE.updateRoute(TABLES_KEY, this.peerPT, LOC_RIB_TARGET, this.ribSupport, this.tx,
+                ROUTE_ID_PA_ADD_PATH);
+        yiiCount = collectInfo();
         assertEquals(2, yiiCount.size());
         assertFalse(yiiCount.containsKey(this.routePaAddPathYii));
         assertFalse(yiiCount.containsKey(this.routeAddRiboutYii));