Fix checkstyle complains 70/73570/1
authorClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Thu, 28 Jun 2018 17:04:25 +0000 (19:04 +0200)
committerClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Thu, 28 Jun 2018 17:04:25 +0000 (19:04 +0200)
Change-Id: I692780c68bc2d57e497fac10e5595550f020b5cf
Signed-off-by: Claudio D. Gasparini <claudio.gasparini@pantheon.tech>
12 files changed:
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/AddPathAllPathsTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/AddPathBasePathsTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/AddPathNPathsTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/AdjRibsInWriterTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/CheckUtil.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/PeerTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/SimpleSessionListener.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/config/AbstractConfig.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/config/BgpDeployerImplTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/config/BgpPeerTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/config/OpenConfigMappingUtilTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/config/RibImplTest.java

index fc0cbd8da2d0b83a569cd527f7a8444ada20d482..8aa96ae56a864a1cbcf7298ae9642d50a68149d3 100644 (file)
@@ -80,13 +80,17 @@ public class AddPathAllPathsTest extends AbstractAddPathTest {
      * [peer://127.0.0.4; p1, lp50] --(iBGP)-->  |                   | --(RR-client, add-path) --> [Peer://127.0.0.6; (p1, path-id1, lp100), (p1, path-id2, pl50), (p1, path-id3, pl200), (p1, path-id4, pl20)]
      * [peer://127.0.0.2; p1, lp20] --(iBGP)-->  |___________________|
      * p1 = 1.1.1.1/32
+     *
+     *
+     *
      */
     @Test
     public void testUseCase1() throws Exception {
         final BgpParameters nonAddPathParams = createParameter(false);
         final BgpParameters addPathParams = createParameter(true);
 
-        final BGPPeer peer1 = configurePeer(this.tableRegistry, PEER1, this.ribImpl, nonAddPathParams, PeerRole.Ibgp, this.serverRegistry);
+        final BGPPeer peer1 = configurePeer(this.tableRegistry, PEER1, this.ribImpl, nonAddPathParams, PeerRole.Ibgp,
+                this.serverRegistry);
         final BGPSessionImpl session1 = createPeerSession(PEER1, nonAddPathParams, new SimpleSessionListener());
 
         configurePeer(this.tableRegistry, PEER2, this.ribImpl, nonAddPathParams, PeerRole.Ibgp, this.serverRegistry);
@@ -96,7 +100,8 @@ public class AddPathAllPathsTest extends AbstractAddPathTest {
         final BGPSessionImpl session3 = createPeerSession(PEER3, nonAddPathParams, new SimpleSessionListener());
 
         final SimpleSessionListener listener4 = new SimpleSessionListener();
-        final BGPPeer peer4 = configurePeer(this.tableRegistry, PEER4, this.ribImpl, nonAddPathParams, PeerRole.RrClient, this.serverRegistry);
+        final BGPPeer peer4 = configurePeer(this.tableRegistry, PEER4, this.ribImpl, nonAddPathParams,
+                PeerRole.RrClient, this.serverRegistry);
 
         BGPPeerState peer4State = peer4.getPeerState();
         assertNull(peer4State.getGroupId());
@@ -157,8 +162,10 @@ public class AddPathAllPathsTest extends AbstractAddPathTest {
         assertEquals(new IpAddress(PEER1), transportStatePeer1.getRemoteAddress());
 
         assertEquals(State.UP, peer1State.getBGPSessionState().getSessionState());
-        checkEquals(()-> assertEquals(1L, peer1State.getBGPPeerMessagesState().getUpdateMessagesReceivedCount()));
-        checkEquals(()-> assertEquals(0L, peer1State.getBGPPeerMessagesState().getUpdateMessagesSentCount()));
+        checkEquals(()-> assertEquals(1L,
+                peer1State.getBGPPeerMessagesState().getUpdateMessagesReceivedCount()));
+        checkEquals(()-> assertEquals(0L,
+                peer1State.getBGPPeerMessagesState().getUpdateMessagesSentCount()));
 
         final BGPSessionState sessionStatePeer1 = peer1State.getBGPSessionState();
         assertFalse(sessionStatePeer1.isAddPathCapabilitySupported());
@@ -191,13 +198,15 @@ public class AddPathAllPathsTest extends AbstractAddPathTest {
         assertEquals(1L, ribState.getTotalPrefixesCount());
 
         final SimpleSessionListener listener6 = new SimpleSessionListener();
-        final BGPPeer peer6 = configurePeer(this.tableRegistry, PEER6, this.ribImpl, nonAddPathParams, PeerRole.RrClient, this.serverRegistry);
+        final BGPPeer peer6 = configurePeer(this.tableRegistry, PEER6, this.ribImpl, nonAddPathParams,
+                PeerRole.RrClient, this.serverRegistry);
         final BGPSessionImpl session6 = createPeerSession(PEER6, nonAddPathParams, listener6);
         checkPeersPresentOnDataStore(6);
         checkReceivedMessages(listener6, 1);
         assertEquals(UPD_NA_100, listener6.getListMsg().get(0));
         causeBGPError(session6);
-        checkEquals(()-> assertEquals(1L, peer6.getPeerState().getBGPPeerMessagesState().getNotificationMessagesSentCount()));
+        checkEquals(()-> assertEquals(1L,
+                peer6.getPeerState().getBGPPeerMessagesState().getNotificationMessagesSentCount()));
 
         checkPeersPresentOnDataStore(5);
 
@@ -268,7 +277,8 @@ public class AddPathAllPathsTest extends AbstractAddPathTest {
         sendRouteAndCheckIsOnLocRib(session1, PREFIX1, 20, 3);
         checkReceivedMessages(listener4, 2);
         checkReceivedMessages(listener5, 4);
-        assertEquals(UPD_200.getAttributes().getLocalPref(), ((Update) listener4.getListMsg().get(1)).getAttributes().getLocalPref());
+        assertEquals(UPD_200.getAttributes().getLocalPref(),
+                ((Update) listener4.getListMsg().get(1)).getAttributes().getLocalPref());
         assertEquals(UPD_20, listener5.getListMsg().get(3));
 
         //withdraw second best route, 1 advertisement(1 withdrawal) for add-path supported, none for non add path
@@ -288,7 +298,8 @@ public class AddPathAllPathsTest extends AbstractAddPathTest {
         checkReceivedMessages(listener5, 7);
 
         sendNotification(session1);
-        checkEquals(()-> assertEquals(1L, peer1.getPeerState().getBGPPeerMessagesState().getNotificationMessagesReceivedCount()));
+        checkEquals(()-> assertEquals(1L,
+                peer1.getPeerState().getBGPPeerMessagesState().getNotificationMessagesReceivedCount()));
         session1.close();
         session2.close();
         session3.close();
index 59531c02a85292f54e1a1c600c2c3d22d4c47069..1ecc97c4582dae9a16f59e549e7142f87356a9df 100644 (file)
@@ -82,7 +82,8 @@ public class AddPathBasePathsTest extends AbstractAddPathTest {
         final BGPSessionImpl session3 = createPeerSession(PEER3,nonAddPathParams, new SimpleSessionListener());
 
         final SimpleSessionListener listener4 = new SimpleSessionListener();
-        configurePeer(this.tableRegistry, PEER4, this.ribImpl, nonAddPathParams, PeerRole.RrClient, this.serverRegistry);
+        configurePeer(this.tableRegistry, PEER4, this.ribImpl, nonAddPathParams, PeerRole.RrClient,
+                this.serverRegistry);
         final BGPSessionImpl session4 = createPeerSession(PEER4, nonAddPathParams, listener4);
 
         final SimpleSessionListener listener5 = new SimpleSessionListener();
@@ -110,7 +111,8 @@ public class AddPathBasePathsTest extends AbstractAddPathTest {
         assertEquals(UPD_NA_200_EBGP, listener5.getListMsg().get(1));
 
         final SimpleSessionListener listener6 = new SimpleSessionListener();
-        configurePeer(this.tableRegistry, PEER6, this.ribImpl, nonAddPathParams, PeerRole.RrClient, this.serverRegistry);
+        configurePeer(this.tableRegistry, PEER6, this.ribImpl, nonAddPathParams, PeerRole.RrClient,
+                this.serverRegistry);
         final BGPSessionImpl session6 = createPeerSession(PEER6, nonAddPathParams, listener6);
 
         checkPeersPresentOnDataStore(6);
index a3e2d4941531ba11b7475aace80f9348b83c69f6..1356cc82ad431110b4d132fa1d3de95793afca28 100644 (file)
@@ -83,7 +83,8 @@ public class AddPathNPathsTest extends AbstractAddPathTest {
         final BGPSessionImpl session3 = createPeerSession(PEER3, nonAddPathParams, new SimpleSessionListener());
 
         final SimpleSessionListener listener4 = new SimpleSessionListener();
-        configurePeer(this.tableRegistry, PEER4, this.ribImpl, nonAddPathParams, PeerRole.RrClient, this.serverRegistry);
+        configurePeer(this.tableRegistry, PEER4, this.ribImpl, nonAddPathParams, PeerRole.RrClient,
+                this.serverRegistry);
         final BGPSessionImpl session4 = createPeerSession(PEER4, nonAddPathParams, listener4);
 
         final SimpleSessionListener listener5 = new SimpleSessionListener();
@@ -98,7 +99,8 @@ public class AddPathNPathsTest extends AbstractAddPathTest {
         assertEquals(UPD_100, listener5.getListMsg().get(0));
 
         final SimpleSessionListener listener6 = new SimpleSessionListener();
-        configurePeer(this.tableRegistry, PEER6, this.ribImpl, nonAddPathParams, PeerRole.RrClient, this.serverRegistry);
+        configurePeer(this.tableRegistry, PEER6, this.ribImpl, nonAddPathParams, PeerRole.RrClient,
+                this.serverRegistry);
         final BGPSessionImpl session6 = createPeerSession(PEER6, nonAddPathParams, listener6);
         checkPeersPresentOnDataStore(6);
         checkReceivedMessages(listener6, 1);
@@ -133,7 +135,8 @@ public class AddPathNPathsTest extends AbstractAddPathTest {
         checkReceivedMessages(listener4, 2);
         checkReceivedMessages(listener5, 6);
 
-        //withdraw second best route, 2 advertisement (1 withdrawal) for add-path supported, 1 withdrawal for non add path
+        //withdraw second best route, 2 advertisement (1 withdrawal) for add-path supported,
+        // 1 withdrawal for non add path
         sendWithdrawalRouteAndCheckIsOnLocRib(session3, PREFIX1, 200, 2);
         checkReceivedMessages(listener4, 3);
         checkReceivedMessages(listener5, 8);
index 5c1f284c022450fa5eae5c2ef2a68f1f7531edd8..a92eee84e84f4ee310889d9612352170e696812d 100644 (file)
@@ -51,7 +51,8 @@ import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
 public class AdjRibsInWriterTest {
 
     private static final TablesKey K4 = new TablesKey(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
-    private static final Map<TablesKey, SendReceive> ADD_PATH_TABLE_MAPS = Collections.singletonMap(K4, SendReceive.Both);
+    private static final Map<TablesKey, SendReceive> ADD_PATH_TABLE_MAPS
+            = Collections.singletonMap(K4, SendReceive.Both);
     private final Set<TablesKey> tableTypes = Sets.newHashSet(K4);
     private final String peerIp = "12.34.56.78";
     @Mock
@@ -102,8 +103,8 @@ public class AdjRibsInWriterTest {
         final YangInstanceIdentifier path = peerPath.node(AdjRibIn.QNAME)
                 .node(Tables.QNAME).node(RibSupportUtils.toYangTablesKey(K4))
                 .node(Attributes.QNAME).node(AdjRibInWriter.ATTRIBUTES_UPTODATE_FALSE.getNodeType());
-        verify(this.tx).merge(eq(LogicalDatastoreType.OPERATIONAL), eq(path)
-                eq(AdjRibInWriter.ATTRIBUTES_UPTODATE_FALSE));
+        verify(this.tx).merge(eq(LogicalDatastoreType.OPERATIONAL), eq(path),
+                eq(AdjRibInWriter.ATTRIBUTES_UPTODATE_FALSE));
     }
 
     private void verifyPeerSkeletonInsertedCorrectly(final YangInstanceIdentifier peerPath) {
index 25e0274374194d5cfc34dfe5baddbd5643d37035..6ec258759186d00f77f7f4b000998c49fd031396 100644 (file)
@@ -14,6 +14,10 @@ import org.junit.Assert;
 import org.opendaylight.protocol.bgp.rib.spi.State;
 
 public final class CheckUtil {
+    private CheckUtil() {
+        throw new UnsupportedOperationException();
+    }
+
     public static void checkIdleState(final SimpleSessionListener listener) {
         final Stopwatch sw = Stopwatch.createStarted();
         while (sw.elapsed(TimeUnit.SECONDS) <= 10) {
index 3925ff3f827335de880ab51f7e7d9a2b64e9388d..62730e76c792d08239bfc2c2dc6a69d4d90b07b6 100644 (file)
@@ -151,8 +151,8 @@ public class PeerTest extends AbstractRIBTestSetup {
                 this.classic.toString());
 
         final Nlri n1 = new NlriBuilder().setPrefix(new Ipv4Prefix("8.0.1.0/28")).build();
-        final Nlri n2 = new NlriBuilder().setPrefix( new Ipv4Prefix("127.0.0.1/32")).build();
-        final Nlri n3 = new NlriBuilder().setPrefix( new Ipv4Prefix("2.2.2.2/24")).build();
+        final Nlri n2 = new NlriBuilder().setPrefix(new Ipv4Prefix("127.0.0.1/32")).build();
+        final Nlri n3 = new NlriBuilder().setPrefix(new Ipv4Prefix("2.2.2.2/24")).build();
         final List<Nlri> nlris = Lists.newArrayList(n1, n2, n3);
         final UpdateBuilder ub = new UpdateBuilder();
         ub.setNlri(nlris);
@@ -186,11 +186,11 @@ public class PeerTest extends AbstractRIBTestSetup {
         assertEquals(3, this.routes.size());
 
         final Nlri n11 = new NlriBuilder().setPrefix(new Ipv4Prefix("8.0.1.0/28")).build();
-        final Nlri n22 = new NlriBuilder().setPrefix( new Ipv4Prefix("8.0.1.16/28")).build();
+        final Nlri n22 = new NlriBuilder().setPrefix(new Ipv4Prefix("8.0.1.16/28")).build();
         final List<Nlri> nlris2 = Lists.newArrayList(n11, n22);
         ub.setNlri(nlris2);
-        final WithdrawnRoutes w1 =new WithdrawnRoutesBuilder().setPrefix(new Ipv4Prefix("8.0.1.0/28")).build();
-        final WithdrawnRoutes w2 =new WithdrawnRoutesBuilder().setPrefix(new Ipv4Prefix("127.0.0.1/32")).build();
+        final WithdrawnRoutes w1 = new WithdrawnRoutesBuilder().setPrefix(new Ipv4Prefix("8.0.1.0/28")).build();
+        final WithdrawnRoutes w2 = new WithdrawnRoutesBuilder().setPrefix(new Ipv4Prefix("127.0.0.1/32")).build();
         final WithdrawnRoutes w3 = new WithdrawnRoutesBuilder().setPrefix(new Ipv4Prefix("2.2.2.2/24")).build();
         final List<WithdrawnRoutes> wrs = Lists.newArrayList(w1, w2, w3);
         ub.setWithdrawnRoutes(wrs);
index d5dfd775ed058996de177b8872cf80505bc99175..401c7679c020fc4a1249cc3ab41158c3355538fb 100644 (file)
@@ -7,6 +7,8 @@
  */
 package org.opendaylight.protocol.bgp.rib.impl;
 
+import static org.junit.Assert.assertTrue;
+
 import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.Futures;
 import com.google.common.util.concurrent.ListenableFuture;
@@ -15,7 +17,6 @@ import java.util.List;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import javax.annotation.concurrent.GuardedBy;
-import org.junit.Assert;
 import org.opendaylight.protocol.bgp.rib.spi.BGPSession;
 import org.opendaylight.protocol.bgp.rib.spi.BGPSessionListener;
 import org.opendaylight.protocol.bgp.rib.spi.BGPTerminationReason;
@@ -34,7 +35,7 @@ public final class SimpleSessionListener implements BGPSessionListener, Listener
     private static final Logger LOG = LoggerFactory.getLogger(SimpleSessionListener.class);
     @GuardedBy("this")
     private final List<Notification> listMsg = Lists.newArrayList();
-    private BGPSession session;
+    private BGPSession bgpSession;
     private final CountDownLatch sessionLatch = new CountDownLatch(1);
 
     public SimpleSessionListener() {
@@ -52,13 +53,13 @@ public final class SimpleSessionListener implements BGPSessionListener, Listener
     @Override
     public void onSessionUp(final BGPSession session) {
         LOG.info("Session Up");
-        this.session = session;
+        this.bgpSession = session;
         this.sessionLatch.countDown();
     }
 
     @Override
-    public void onSessionDown(final BGPSession session, final Exception e) {
-        LOG.debug("Session Down", e);
+    public void onSessionDown(final BGPSession session, final Exception exception) {
+        LOG.debug("Session Down", exception);
     }
 
     @Override
@@ -73,11 +74,12 @@ public final class SimpleSessionListener implements BGPSessionListener, Listener
     }
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public ListenableFuture<Void> releaseConnection() {
         LOG.debug("Releasing connection");
-        if (this.session != null) {
+        if (this.bgpSession != null) {
             try {
-                this.session.close();
+                this.bgpSession.close();
             } catch (final Exception e) {
                 LOG.warn("Error closing session", e);
             }
@@ -90,8 +92,9 @@ public final class SimpleSessionListener implements BGPSessionListener, Listener
     }
 
     BGPSessionImpl getSession() {
-        Assert.assertTrue("Session up", Uninterruptibles.awaitUninterruptibly(this.sessionLatch, 10, TimeUnit.SECONDS));
-        return (BGPSessionImpl) this.session;
+        assertTrue("Session up",
+                Uninterruptibles.awaitUninterruptibly(this.sessionLatch, 10, TimeUnit.SECONDS));
+        return (BGPSessionImpl) this.bgpSession;
     }
 
     @Override
index fee0253802781ab789ef7103ea32eac8b227ae57..3c9f100f2c10aad455fa79cf7b866375a373ff14 100644 (file)
@@ -61,7 +61,7 @@ import org.osgi.framework.ServiceRegistration;
 
 class AbstractConfig extends DefaultRibPoliciesMockTest {
     protected static final AsNumber AS = new AsNumber(72L);
-    protected static final AsNumber lOCAL_AS = new AsNumber(73L);
+    protected static final AsNumber LOCAL_AS = new AsNumber(73L);
     protected static final RibId RIB_ID = new RibId("test");
     static final TablesKey TABLES_KEY = new TablesKey(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
     @Mock
index fbb26ad60f9f29d41ebca782a2d75648dcc51ced..f655855e97567e24426b260e24b5bb10336fb903 100644 (file)
@@ -167,9 +167,6 @@ public class BgpDeployerImplTest extends DefaultRibPoliciesMockTest {
         deployer.close();
     }
 
-    /**
-     * Test create Rib
-     */
     @Test
     public void testDeployerCreateNeighbor() throws Exception {
         deployer.init();
index 021be4ab5814881e9364f9930c7a4ee28238eeb8..1973f16eaf266afdde9fdff522c32098f3b92c4d 100644 (file)
@@ -79,8 +79,8 @@ public class BgpPeerTest extends AbstractConfig {
     }
 
     static Transport createTransport() {
-        return new TransportBuilder().setConfig(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.
-                rev151009.bgp.neighbor.group.transport.ConfigBuilder().setMtuDiscovery(false)
+        return new TransportBuilder().setConfig(new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp
+                .rev151009.bgp.neighbor.group.transport.ConfigBuilder().setMtuDiscovery(false)
                 .setPassiveMode(false).addAugmentation(NeighborTransportConfig.class,
                         new NeighborTransportConfigBuilder().setRemotePort(PORT).build()).build()).build();
     }
@@ -102,10 +102,10 @@ public class BgpPeerTest extends AbstractConfig {
     }
 
     static Config createConfig() {
-        return new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.
-                ConfigBuilder()
+        return new org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group
+                .ConfigBuilder()
                 .setPeerAs(AS)
-                .setLocalAs(lOCAL_AS)
+                .setLocalAs(LOCAL_AS)
                 .setPeerType(PeerType.INTERNAL)
                 .setAuthPassword(MD5_PASSWORD)
                 .setRouteFlapDamping(false)
index 66da908cd8094c36b2848544e1a81c1d94961b39..e99fb8b0fec076f680fc58c077ada653600db710 100644 (file)
@@ -13,6 +13,8 @@ import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.MockitoAnnotations.initMocks;
 import static org.opendaylight.protocol.bgp.rib.impl.config.BgpPeerTest.AFI_SAFI;
 import static org.opendaylight.protocol.bgp.rib.impl.config.BgpPeerTest.AFI_SAFI_IPV4;
 import static org.opendaylight.protocol.bgp.rib.impl.config.BgpPeerTest.MD5_PASSWORD;
@@ -36,8 +38,6 @@ import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.MockitoAnnotations;
 import org.opendaylight.protocol.bgp.mode.api.PathSelectionMode;
 import org.opendaylight.protocol.bgp.mode.impl.add.all.paths.AllPathSelection;
 import org.opendaylight.protocol.bgp.mode.impl.add.n.paths.AddPathBestNPathSelection;
@@ -159,19 +159,19 @@ public class OpenConfigMappingUtilTest {
 
     @Before
     public void setUp() {
-        MockitoAnnotations.initMocks(this);
-        Mockito.doReturn(java.util.Optional.of(BGP_TABLE_TYPE_IPV4))
+        initMocks(this);
+        doReturn(java.util.Optional.of(BGP_TABLE_TYPE_IPV4))
             .when(this.tableTypeRegistry).getTableType(IPV4UNICAST.class);
-        Mockito.doReturn(java.util.Optional.of(BGP_TABLE_TYPE_IPV6))
+        doReturn(java.util.Optional.of(BGP_TABLE_TYPE_IPV6))
             .when(this.tableTypeRegistry).getTableType(IPV6UNICAST.class);
-        Mockito.doReturn(java.util.Optional.of(new BgpTableTypeImpl(Ipv6AddressFamily.class,
+        doReturn(java.util.Optional.of(new BgpTableTypeImpl(Ipv6AddressFamily.class,
                 MplsLabeledVpnSubsequentAddressFamily.class)))
             .when(this.tableTypeRegistry).getTableType(IPV6LABELLEDUNICAST.class);
-        Mockito.doReturn(java.util.Optional.of(IPV4UNICAST.class))
+        doReturn(java.util.Optional.of(IPV4UNICAST.class))
             .when(this.tableTypeRegistry).getAfiSafiType(BGP_TABLE_TYPE_IPV4);
-        Mockito.doReturn(java.util.Optional.of(IPV6UNICAST.class))
+        doReturn(java.util.Optional.of(IPV6UNICAST.class))
             .when(this.tableTypeRegistry).getAfiSafiType(BGP_TABLE_TYPE_IPV6);
-        Mockito.doReturn(AS).when(this.rib).getLocalAs();
+        doReturn(AS).when(this.rib).getLocalAs();
     }
 
     @Test
@@ -181,9 +181,6 @@ public class OpenConfigMappingUtilTest {
 
     @Test
     public void testGetHoldTimer() {
-        TimersBuilder builder = new TimersBuilder().setConfig(new org.opendaylight.yang.gen.v1.http.openconfig.net
-                .yang.bgp.rev151009.bgp.neighbor.group.timers.ConfigBuilder().setHoldTime(BigDecimal.TEN).build());
-
         assertEquals(DEFAULT_TIMERS.toBigInteger().intValue(),
                 OpenConfigMappingUtil.getHoldTimer(NEIGHBOR, null));
         assertEquals(HOLDTIMER,
@@ -191,6 +188,8 @@ public class OpenConfigMappingUtilTest {
 
         assertEquals(DEFAULT_TIMERS.toBigInteger().intValue(),
                 OpenConfigMappingUtil.getHoldTimer(NEIGHBOR, new PeerGroupBuilder().build()));
+        TimersBuilder builder = new TimersBuilder().setConfig(new org.opendaylight.yang.gen.v1.http.openconfig.net
+                .yang.bgp.rev151009.bgp.neighbor.group.timers.ConfigBuilder().setHoldTime(BigDecimal.TEN).build());
         assertEquals(BigDecimal.TEN.intValue(), OpenConfigMappingUtil.getHoldTimer(NEIGHBOR, new PeerGroupBuilder()
                 .setTimers(builder.build()).build()));
     }
index 83ae6e5f67bc5f73eeab67829f00e5716b5fc377..305b8f8655f83f9543a0745f09ba004ed7f76963 100644 (file)
@@ -11,6 +11,8 @@ package org.opendaylight.protocol.bgp.rib.impl.config;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 
@@ -23,7 +25,6 @@ import java.util.List;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
-import org.mockito.Mockito;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataBroker;
 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService;
 import org.opendaylight.mdsal.binding.dom.codec.api.BindingCodecTreeFactory;
@@ -50,8 +51,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.type
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.UnicastSubsequentAddressFamily;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.common.QName;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
 import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
 import org.osgi.framework.ServiceRegistration;
 
@@ -88,26 +89,26 @@ public class RibImplTest extends AbstractConfig {
     public void setUp() throws Exception {
         super.setUp();
 
-        Mockito.doReturn(mock(GeneratedClassLoadingStrategy.class)).when(this.extension).getClassLoadingStrategy();
-        Mockito.doReturn(this.ribSupport).when(this.extension).getRIBSupport(any(TablesKey.class));
+        doReturn(mock(GeneratedClassLoadingStrategy.class)).when(this.extension).getClassLoadingStrategy();
+        doReturn(this.ribSupport).when(this.extension).getRIBSupport(any(TablesKey.class));
         final NodeIdentifier nii = new NodeIdentifier(QName.create("", "test").intern());
-        Mockito.doReturn(nii).when(this.ribSupport).routeAttributesIdentifier();
-        Mockito.doReturn(ImmutableSet.of()).when(this.ribSupport).cacheableAttributeObjects();
+        doReturn(nii).when(this.ribSupport).routeAttributesIdentifier();
+        doReturn(ImmutableSet.of()).when(this.ribSupport).cacheableAttributeObjects();
         final MapEntryNode emptyTable = mock(MapEntryNode.class);
-        Mockito.doReturn(emptyTable).when(this.ribSupport).emptyTable();
+        doReturn(emptyTable).when(this.ribSupport).emptyTable();
         final NodeIdentifierWithPredicates niie = new NodeIdentifierWithPredicates(Rib.QNAME,
                 ImmutableMap.of(QName.create("", "test").intern(), "t"));
-        Mockito.doReturn(niie).when(emptyTable).getIdentifier();
-        Mockito.doReturn(QName.create("", "test").intern()).when(emptyTable).getNodeType();
-        Mockito.doReturn(this.domTx).when(this.domDataBroker).createTransactionChain(any());
+        doReturn(niie).when(emptyTable).getIdentifier();
+        doReturn(QName.create("", "test").intern()).when(emptyTable).getNodeType();
+        doReturn(this.domTx).when(this.domDataBroker).createTransactionChain(any());
         final DOMDataTreeChangeService dOMDataTreeChangeService = mock(DOMDataTreeChangeService.class);
-        Mockito.doReturn(Collections.singletonMap(DOMDataTreeChangeService.class, dOMDataTreeChangeService))
+        doReturn(Collections.singletonMap(DOMDataTreeChangeService.class, dOMDataTreeChangeService))
                 .when(this.domDataBroker).getSupportedExtensions();
-        Mockito.doReturn(this.dataTreeRegistration).when(this.domSchemaService).registerSchemaContextListener(any());
-        Mockito.doNothing().when(this.dataTreeRegistration).close();
-        Mockito.doReturn(mock(ListenerRegistration.class)).when(dOMDataTreeChangeService)
+        doReturn(this.dataTreeRegistration).when(this.domSchemaService).registerSchemaContextListener(any());
+        doNothing().when(this.dataTreeRegistration).close();
+        doReturn(mock(ListenerRegistration.class)).when(dOMDataTreeChangeService)
                 .registerDataTreeChangeListener(any(), any());
-        Mockito.doNothing().when(this.serviceRegistration).unregister();
+        doNothing().when(this.serviceRegistration).unregister();
     }
 
     @Test