Revision: 1505
Author: sberlin
Date: Mon Feb 21 13:09:26 2011
Log: test for issue 608.
http://code.google.com/p/google-guice/source/detail?r=1505

Modified:
 /trunk/core/test/com/google/inject/ParentInjectorTest.java

=======================================
--- /trunk/core/test/com/google/inject/ParentInjectorTest.java Sat Feb 19 16:05:28 2011 +++ /trunk/core/test/com/google/inject/ParentInjectorTest.java Mon Feb 21 13:09:26 2011
@@ -18,6 +18,7 @@

 import static com.google.inject.Asserts.assertContains;
 import com.google.inject.internal.util.ImmutableList;
+import com.google.inject.internal.util.Iterables;
 import com.google.inject.matcher.Matchers;
 import com.google.inject.name.Names;
 import com.google.inject.spi.TypeConverter;
@@ -56,6 +57,18 @@
"A binding to " + A.class.getName() + " was already configured at " + bindsA.getClass().getName());
     }
   }
+
+  public void testChildCannotBindToAParentJitBinding() {
+    Injector parent = Guice.createInjector();
+    parent.getInstance(A.class);
+    try {
+      parent.createChildInjector(bindsA);
+      fail();
+    } catch(CreationException ce) {
+ assertContains(Iterables.getOnlyElement(ce.getErrorMessages()).getMessage(), + "A just-in-time binding to " + A.class.getName() + " was already configured on a parent injector.");
+    }
+  }

   public void testJustInTimeBindingsAreSharedWithParentIfPossible() {
     Injector parent = Guice.createInjector();

--
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