Author: limpbizkit
Date: Wed Jun  3 00:32:18 2009
New Revision: 993

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

Log:
Test for an issue reported by Dmitry Skavish regarding which injector  
creates a scoped class:
http://groups.google.com/group/google-guice/browse_thread/thread/8f0a092727a0227c



Modified: trunk/test/com/google/inject/ParentInjectorTest.java
==============================================================================
--- trunk/test/com/google/inject/ParentInjectorTest.java        (original)
+++ trunk/test/com/google/inject/ParentInjectorTest.java        Wed Jun  3  
00:32:18 2009
@@ -195,6 +195,27 @@
      }
    }

+  public void testScopeBoundInChildInjectorOnly() {
+    Injector parent = Guice.createInjector();
+    Injector child = parent.createChildInjector(new AbstractModule() {
+      protected void configure() {
+        bindScope(MyScope.class, Scopes.SINGLETON);
+      }
+    });
+
+    try {
+      parent.getProvider(F.class);
+      fail();
+    } catch (ConfigurationException expected) {
+      assertContains(expected.getMessage(),
+          "No scope is bound to  
com.google.inject.ParentInjectorTest$MyScope.",
+          "at " + F.class.getName() + ".class(ParentInjectorTest.java",
+          "  while locating " + F.class.getName());
+    }
+
+    assertNotNull(child.getProvider(F.class).get());
+  }
+
    @Singleton
    static class A {}

@@ -253,4 +274,7 @@
        bind(D.class);
      }
    };
+
+  @MyScope
+  static class F {}
  }

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