config-manager: final parameters
[controller.git] / opendaylight / config / config-manager / src / test / java / org / opendaylight / controller / config / manager / impl / osgi / ModuleFactoryBundleTrackerTest.java
index 5b83412083c359b09c80b5c2caac7d78fec0a16f..d694e981d6ed3af673c2223fd4307c9df6af9801 100644 (file)
@@ -1,8 +1,16 @@
+/*
+ * Copyright (c) 2014, 2015 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
+
 package org.opendaylight.controller.config.manager.impl.osgi;
 
-import static junit.framework.Assert.assertEquals;
-import static junit.framework.Assert.assertNotNull;
-import static junit.framework.Assert.fail;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
 import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyObject;
 import static org.mockito.Matchers.anyString;
@@ -11,10 +19,8 @@ import static org.mockito.Mockito.doReturn;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyZeroInteractions;
-
 import java.util.Dictionary;
 import java.util.Set;
-
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.Mock;
@@ -44,7 +50,7 @@ public class ModuleFactoryBundleTrackerTest {
     @Before
     public void setUp() throws Exception {
         MockitoAnnotations.initMocks(this);
-        doAnswer(new Answer() {
+        doAnswer(new Answer<Object>() {
             @Override
             public Object answer(final InvocationOnMock invocation) throws Throwable {
                 return getClass().getClassLoader().loadClass((String) invocation.getArguments()[0]);
@@ -65,7 +71,7 @@ public class ModuleFactoryBundleTrackerTest {
     public void testRegisterFactoryInstantiateEx() throws Exception {
         try {
             ModuleFactoryBundleTracker.registerFactory(WrongConstructorTestingFactory.class.getName(), bundle);
-        } catch (Exception e) {
+        } catch (final Exception e) {
             verifyZeroInteractions(context);
             assertNotNull(e.getCause());
             assertEquals(InstantiationException.class, e.getCause().getClass());
@@ -79,7 +85,7 @@ public class ModuleFactoryBundleTrackerTest {
     public void testRegisterFactoryInstantiateExAccess() throws Exception {
         try {
             ModuleFactoryBundleTracker.registerFactory(NoAccessConstructorTestingFactory.class.getName(), bundle);
-        } catch (Exception e) {
+        } catch (final Exception e) {
             verifyZeroInteractions(context);
             assertNotNull(e.getCause());
             assertEquals(IllegalAccessException.class, e.getCause().getClass());
@@ -93,7 +99,7 @@ public class ModuleFactoryBundleTrackerTest {
     public void testRegisterFactoryNotExtending() throws Exception {
         try {
             ModuleFactoryBundleTracker.registerFactory(NotExtendingTestingFactory.class.getName(), bundle);
-        } catch (Exception e) {
+        } catch (final Exception e) {
             verifyZeroInteractions(context);
             return;
         }
@@ -105,7 +111,7 @@ public class ModuleFactoryBundleTrackerTest {
     public void testRegisterFactoryNotExisting() throws Exception {
         try {
             ModuleFactoryBundleTracker.registerFactory("Unknown class", bundle);
-        } catch (Exception e) {
+        } catch (final Exception e) {
             verifyZeroInteractions(context);
             assertNotNull(e.getCause());
             assertEquals(ClassNotFoundException.class, e.getCause().getClass());
@@ -132,7 +138,7 @@ public class ModuleFactoryBundleTrackerTest {
         doReturn(getClass().getResource("/module-factories/module-factory-fail")).when(bundle).getEntry(anyString());
         try {
             tracker.addingBundle(bundle, mock(BundleEvent.class));
-        } catch (Exception e) {
+        } catch (final Exception e) {
             verifyZeroInteractions(context);
             return;
         }
@@ -141,7 +147,7 @@ public class ModuleFactoryBundleTrackerTest {
     }
 
     static class WrongConstructorTestingFactory extends TestingFactory {
-        WrongConstructorTestingFactory(String randomParam) {
+        WrongConstructorTestingFactory(final String randomParam) {
         }
     }