AbstractGuiceJsr250Module configureBindings() throws Exception
authorMichael Vorburger <vorburger@redhat.com>
Thu, 24 Nov 2016 23:59:19 +0000 (00:59 +0100)
committerMichael Vorburger <vorburger@redhat.com>
Thu, 24 Nov 2016 23:59:48 +0000 (00:59 +0100)
Change-Id: I9e18b423d2dcf6230536cab04abf62e3d31a79c0
Signed-off-by: Michael Vorburger <vorburger@redhat.com>
inject-guice-testutils/pom.xml
inject-guice-testutils/src/main/java/org/opendaylight/infrautils/inject/guice/testutils/AbstractGuiceJsr250Module.java

index 1efe7d39255881acab6f9593317f71847b2ec0eb..020ec96a661fe224b7e1e5cde229040bd95b9e42 100644 (file)
@@ -13,7 +13,7 @@
     <groupId>org.opendaylight.odlparent</groupId>
     <artifactId>odlparent</artifactId>
     <version>1.8.0-SNAPSHOT</version>
-    <relativePath/>
+    <relativePath />
   </parent>
 
   <groupId>org.opendaylight.infrautils</groupId>
       <scope>compile</scope>
     </dependency>
     <dependency>
-        <groupId>com.google.truth</groupId>
-        <artifactId>truth</artifactId>
+      <groupId>com.google.truth</groupId>
+      <artifactId>truth</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.opendaylight.infrautils</groupId>
+      <artifactId>inject</artifactId>
+      <version>${project.version}</version>
     </dependency>
   </dependencies>
 </project>
index 179ca604cb21253d79c782e827a1b8b7c3c27421..46f3a5a7a880b5039082a580e15bdd73f8f7b5a7 100644 (file)
@@ -10,6 +10,7 @@ package org.opendaylight.infrautils.inject.guice.testutils;
 import com.google.inject.AbstractModule;
 import com.mycila.guice.ext.closeable.CloseableModule;
 import com.mycila.guice.ext.jsr250.Jsr250Module;
+import org.opendaylight.infrautils.inject.ModuleSetupRuntimeException;
 
 /**
  * Guice module with built-in Mycila Guice Extensions for JSR-250 &amp;
@@ -20,12 +21,17 @@ import com.mycila.guice.ext.jsr250.Jsr250Module;
 public abstract class AbstractGuiceJsr250Module extends AbstractModule {
 
     @Override
-    protected final void configure() {
+    @SuppressWarnings("checkstyle:IllegalCatch")
+    protected final void configure() throws ModuleSetupRuntimeException {
         install(new CloseableModule());
         install(new Jsr250Module());
-        configureBindings();
+        try {
+            configureBindings();
+        } catch (Exception e) {
+            throw new ModuleSetupRuntimeException(e);
+        }
     }
 
-    protected abstract void configureBindings();
+    protected abstract void configureBindings() throws Exception;
 
 }