Author: limpbizkit
Date: Sun Nov  2 01:57:12 2008
New Revision: 656

Modified:
    trunk/test/com/google/inject/RequestInjectionTest.java

Log:
Tests that proves issue 209 is fixed...

Modified: trunk/test/com/google/inject/RequestInjectionTest.java
==============================================================================
--- trunk/test/com/google/inject/RequestInjectionTest.java      (original)
+++ trunk/test/com/google/inject/RequestInjectionTest.java      Sun Nov  2  
01:57:12 2008
@@ -120,6 +120,36 @@
      }
    }

+  public void testUserExceptionWhileInjectingInstance() {
+    try {
+      Guice.createInjector(new AbstractModule() {
+        protected void configure() {
+          requestInjection(new BlowsUpOnInject());
+        }
+      });
+      fail();
+    } catch (CreationException expected) {
+      assertContains(expected.getMessage(),
+          "1) Error injecting method,  
java.lang.UnsupportedOperationException: Pop\n",
+          "at " + BlowsUpOnInject.class.getName()  
+ ".injectInstance(RequestInjectionTest.java:");
+    }
+  }
+
+  public void testUserExceptionWhileInjectingStatically() {
+    try {
+      Guice.createInjector(new AbstractModule() {
+        protected void configure() {
+          requestStaticInjection(BlowsUpOnInject.class);
+        }
+      });
+      fail();
+    } catch (CreationException expected) {
+      assertContains(expected.getMessage(),
+          "1) Error injecting method,  
java.lang.UnsupportedOperationException: Snap",
+          "at " + BlowsUpOnInject.class.getName()  
+ ".injectStatically(RequestInjectionTest.java:");
+    }
+  }
+
    static class NeedsRunnable {
      @Inject Runnable runnable;
    }
@@ -138,6 +168,16 @@

      @Inject void setInstanceS(@ForMethod String instanceS) {
        this.instanceMethod = instanceS;
+    }
+  }
+
+  static class BlowsUpOnInject {
+    @Inject void injectInstance() {
+      throw new UnsupportedOperationException("Pop");
+    }
+
+    @Inject static void injectStatically() {
+      throw new UnsupportedOperationException("Snap");
      }
    }
  }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"google-guice-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/google-guice-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to