Fix AbstractRIBTestSetup checkstyle 13/80813/2
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 13 Mar 2019 10:10:53 +0000 (11:10 +0100)
committerRobert Varga <nite@hq.sk>
Wed, 13 Mar 2019 11:44:04 +0000 (11:44 +0000)
- do not mask exceptions
- rename test listener class

Change-Id: I003d2b67d064cfeda75a1bbf3275fb275baab5fc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/AbstractRIBTestSetup.java

index 4b7a333d47d3009e1bb542a4aa5264669de7c325..d2b10b1d877b6e08360ca7c6f13ab446104c2123 100644 (file)
@@ -138,15 +138,9 @@ public class AbstractRIBTestSetup extends DefaultRibPoliciesMockTest {
     @Mock
     private ClusterSingletonServiceProvider clusterSingletonServiceProvider;
 
-    private static ModuleInfoBackedContext createClassLoadingStrategy() {
+    private static ModuleInfoBackedContext createClassLoadingStrategy() throws Exception {
         final ModuleInfoBackedContext ctx = ModuleInfoBackedContext.create();
-        try {
-            ctx.registerModuleInfo(BindingReflections.getModuleInfo(Ipv4Route.class));
-        } catch (final RuntimeException e) {
-            throw e;
-        } catch (final Exception e) {
-            throw new RuntimeException(e);
-        }
+        ctx.registerModuleInfo(BindingReflections.getModuleInfo(Ipv4Route.class));
         return ctx;
     }
 
@@ -195,7 +189,7 @@ public class AbstractRIBTestSetup extends DefaultRibPoliciesMockTest {
     private void mockedMethods() throws Exception {
         MockitoAnnotations.initMocks(this);
         final ReadOnlyTransaction readTx = mock(ReadOnlyTransaction.class);
-        doReturn(new listenerRegistration()).when(this.service)
+        doReturn(new TestListenerRegistration()).when(this.service)
                 .registerDataTreeChangeListener(any(DOMDataTreeIdentifier.class),
                         any(ClusteredDOMDataTreeChangeListener.class));
         final Map<Class<? extends DOMDataBrokerExtension>, DOMDataBrokerExtension> map = new HashMap<>();
@@ -279,7 +273,7 @@ public class AbstractRIBTestSetup extends DefaultRibPoliciesMockTest {
         this.a1.close();
     }
 
-    private class listenerRegistration implements ListenerRegistration<EventListener> {
+    private class TestListenerRegistration implements ListenerRegistration<EventListener> {
         @Override
         public EventListener getInstance() {
             return null;