Enforce findbug & checkstyle for bgp inet
[bgpcep.git] / bgp / inet / src / test / java / org / opendaylight / protocol / bgp / inet / IPv6RIBSupportTest.java
index 4c0f31b85eeeb977d4132a6b389c10cf74ba055f..951600ccf6a8ff2ebd1f369529517d1878f59dc1 100644 (file)
@@ -8,9 +8,9 @@
 
 package org.opendaylight.protocol.bgp.inet;
 
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
+
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
@@ -54,19 +54,24 @@ public final class IPv6RIBSupportTest extends AbstractRIBSupportTest {
     private static final Ipv6Prefix PREFIX = new Ipv6Prefix("2001:db8:1:2::/64");
     private static final Ipv6RouteKey ROUTE_KEY = new Ipv6RouteKey(PATH_ID, PREFIX);
     private static final Ipv6Prefixes IPV6_PREFIXES = new Ipv6PrefixesBuilder().setPathId(PATH_ID)
-        .setPrefix(PREFIX).build();
-    private static final DestinationIpv6Case REACH_NLRI = new DestinationIpv6CaseBuilder().setDestinationIpv6(new DestinationIpv6Builder()
-        .setIpv6Prefixes(Lists.newArrayList(IPV6_PREFIXES)).build()).build();
+            .setPrefix(PREFIX).build();
+    private static final DestinationIpv6Case REACH_NLRI = new DestinationIpv6CaseBuilder()
+            .setDestinationIpv6(new DestinationIpv6Builder()
+                    .setIpv6Prefixes(Lists.newArrayList(IPV6_PREFIXES)).build()).build();
 
     private static final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update
-        .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6Case UNREACH_NLRI =
-        new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update
-            .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6CaseBuilder().setDestinationIpv6(
-            new DestinationIpv6Builder().setIpv6Prefixes(Lists.newArrayList(IPV6_PREFIXES)).build()).build();
-
-    private static final Ipv6Route ROUTE = new Ipv6RouteBuilder().setAttributes(ATTRIBUTES).setPathId(PATH_ID).setPrefix(PREFIX).build();
-    private static final Ipv6Routes ROUTES = new Ipv6RoutesBuilder().setIpv6Route(Collections.singletonList(ROUTE)).build();
-    private static final Ipv6Routes EMPTY_ROUTES = new Ipv6RoutesBuilder().setIpv6Route(Collections.emptyList()).build();
+            .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6Case UNREACH_NLRI =
+            new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update
+                    .attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6CaseBuilder()
+                    .setDestinationIpv6(new DestinationIpv6Builder()
+                            .setIpv6Prefixes(Collections.singletonList(IPV6_PREFIXES)).build()).build();
+
+    private static final Ipv6Route ROUTE = new Ipv6RouteBuilder().setAttributes(ATTRIBUTES).setPathId(PATH_ID)
+            .setPrefix(PREFIX).build();
+    private static final Ipv6Routes ROUTES = new Ipv6RoutesBuilder()
+            .setIpv6Route(Collections.singletonList(ROUTE)).build();
+    private static final Ipv6Routes EMPTY_ROUTES = new Ipv6RoutesBuilder()
+            .setIpv6Route(Collections.emptyList()).build();
 
     @Override
     public void setUp() throws Exception {
@@ -77,7 +82,8 @@ public final class IPv6RIBSupportTest extends AbstractRIBSupportTest {
     @Test
     public void testDeleteRoutes() {
         RIB_SUPPORT.deleteRoutes(this.tx, getTablePath(), createNlriWithDrawnRoute(UNREACH_NLRI));
-        final InstanceIdentifier<Ipv6Route> instanceIdentifier = (InstanceIdentifier<Ipv6Route>) this.deletedRoutes.get(0);
+        @SuppressWarnings("unchecked") final InstanceIdentifier<Ipv6Route> instanceIdentifier =
+                (InstanceIdentifier<Ipv6Route>) this.deletedRoutes.get(0);
         assertEquals(ROUTE_KEY, instanceIdentifier.firstKeyOf(Ipv6Route.class));
     }
 
@@ -99,14 +105,16 @@ public final class IPv6RIBSupportTest extends AbstractRIBSupportTest {
     @Test
     public void testBuildMpUnreachNlriUpdate() {
         final Update update = RIB_SUPPORT.buildUpdate(Collections.emptyList(), createRoutes(ROUTES), ATTRIBUTES);
-        assertEquals(UNREACH_NLRI, update.getAttributes().getAugmentation(Attributes2.class).getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
+        assertEquals(UNREACH_NLRI, update.getAttributes().getAugmentation(Attributes2.class)
+                .getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
         assertNull(update.getAttributes().getAugmentation(Attributes1.class));
     }
 
     @Test
     public void testBuildMpReachNlriUpdate() {
         final Update update = RIB_SUPPORT.buildUpdate(createRoutes(ROUTES), Collections.emptyList(), ATTRIBUTES);
-        assertEquals(REACH_NLRI, update.getAttributes().getAugmentation(Attributes1.class).getMpReachNlri().getAdvertizedRoutes().getDestinationType());
+        assertEquals(REACH_NLRI, update.getAttributes().getAugmentation(Attributes1.class)
+                .getMpReachNlri().getAdvertizedRoutes().getDestinationType());
         assertNull(update.getAttributes().getAugmentation(Attributes2.class));
     }
 
@@ -117,60 +125,63 @@ public final class IPv6RIBSupportTest extends AbstractRIBSupportTest {
 
     @Test
     public void testCacheableNlriObjects() {
-        Assert.assertEquals(ImmutableSet.of(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.Ipv6Prefix.class),
-            RIB_SUPPORT.cacheableNlriObjects());
+        assertEquals(ImmutableSet.of(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet
+                .rev171207.Ipv6Prefix.class), RIB_SUPPORT.cacheableNlriObjects());
     }
 
     @Test
     public void testCacheableAttributeObjects() {
-        Assert.assertEquals(ImmutableSet.of(), RIB_SUPPORT.cacheableAttributeObjects());
+        assertEquals(ImmutableSet.of(), RIB_SUPPORT.cacheableAttributeObjects());
     }
 
     @Test
     public void testRouteIdAddPath() {
         final NodeIdentifierWithPredicates expected = createRouteNIWP(ROUTES);
-        final NodeIdentifierWithPredicates prefixNii = new NodeIdentifierWithPredicates(RIB_SUPPORT.routeQName(), ImmutableMap.of(RIB_SUPPORT.routeKeyQName(), PREFIX.getValue()));
-        Assert.assertEquals(expected, RIB_SUPPORT.getRouteIdAddPath(AbstractRIBSupportTest.PATH_ID, prefixNii));
+        final NodeIdentifierWithPredicates prefixNii = new NodeIdentifierWithPredicates(RIB_SUPPORT.routeQName(),
+                ImmutableMap.of(RIB_SUPPORT.routeKeyQName(), PREFIX.getValue()));
+        assertEquals(expected, RIB_SUPPORT.getRouteIdAddPath(AbstractRIBSupportTest.PATH_ID, prefixNii));
     }
 
     @Test
     public void testRoutePath() {
         final NodeIdentifierWithPredicates prefixNii = createRouteNIWP(ROUTES);
-        Assert.assertEquals(getRoutePath().node(prefixNii), RIB_SUPPORT.routePath(getTablePath().node(Routes.QNAME), prefixNii));
+        assertEquals(getRoutePath().node(prefixNii),
+                RIB_SUPPORT.routePath(getTablePath().node(Routes.QNAME), prefixNii));
     }
 
 
     @Test
     public void testExtractPathId() {
         final NormalizedNode<?, ?> route = Iterables.getOnlyElement(createRoutes(ROUTES));
-        Assert.assertEquals(PATH_ID.getValue(), RIB_SUPPORT.extractPathId(route));
+        assertEquals(PATH_ID.getValue(), RIB_SUPPORT.extractPathId(route));
     }
 
     @Test
     public void testRouteAttributesIdentifier() {
-        Assert.assertEquals(new NodeIdentifier(QName.create(Ipv6Routes.QNAME, Attributes.QNAME.getLocalName().intern())), RIB_SUPPORT
-            .routeAttributesIdentifier());
+        assertEquals(new NodeIdentifier(QName.create(Ipv6Routes.QNAME,
+                Attributes.QNAME.getLocalName().intern())), RIB_SUPPORT.routeAttributesIdentifier());
     }
 
     @Test
     public void testRoutesCaseClass() {
-        Assert.assertEquals(Ipv6RoutesCase.class, RIB_SUPPORT.routesCaseClass());
+        assertEquals(Ipv6RoutesCase.class, RIB_SUPPORT.routesCaseClass());
     }
 
     @Test
     public void testRoutesContainerClass() {
-        Assert.assertEquals(Ipv6Routes.class, RIB_SUPPORT.routesContainerClass());
+        assertEquals(Ipv6Routes.class, RIB_SUPPORT.routesContainerClass());
     }
 
     @Test
     public void testRoutesListClass() {
-        Assert.assertEquals(Ipv6Route.class, RIB_SUPPORT.routesListClass());
+        assertEquals(Ipv6Route.class, RIB_SUPPORT.routesListClass());
     }
 
     @Test
     public void testChangedRoutes() {
         final Routes emptyCase = new Ipv6RoutesCaseBuilder().build();
-        DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyCase)).getRootNode();
+        DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(),
+                createRoutes(emptyCase)).getRootNode();
         Assert.assertTrue(RIB_SUPPORT.changedRoutes(tree).isEmpty());
 
         final Routes emptyRoutes = new Ipv6RoutesCaseBuilder().setIpv6Routes(new Ipv6RoutesBuilder().build()).build();