(no commit message)
authorErik Brakkee <erik@brakkee.org>
Sun, 15 Nov 2009 10:41:14 +0000 (10:41 +0000)
committerErik Brakkee <erik@brakkee.org>
Sun, 15 Nov 2009 10:41:14 +0000 (10:41 +0000)
system/general/src/test/java/org/wamblee/system/adapters/SetterConfigurationTest.java

index 382beb36d4dbb01ca180d09a70e6b333f9a43164..34f06a38443df146c4146e162ffec47778fb1e90 100644 (file)
@@ -317,6 +317,28 @@ public class SetterConfigurationTest extends AdapterTestCase {
                assertEquals("hello", obj.getHost());
                assertNull(obj.getPort());
        }
+       
+       public void testRemoveByMethodObject() throws NoSuchMethodException {
+        SetterConfiguration config = new SetterConfiguration(X6.class).initAllSetters();
+        config.remove(X6.class.getMethod("setPort", Integer.class));
+        List<RequiredInterface> required = config.getRequiredInterfaces();
+        Collections.sort(required, new RequiredInterfaceComparator());
+        assertEquals(1, required.size());
+        assertEquals("setHost", required.get(0).getName());
+
+        ProvidedInterface provided0 = new DefaultProvidedInterface("janse",
+                String.class);
+        required.get(0).setProvider(provided0);
+        _scope.publishInterface(provided0, "hello");
+
+        X6 obj = new X6();
+        assertNull(obj.getHost());
+        assertNull(obj.getPort());
+
+        config.inject(_scope, obj);
+        assertEquals("hello", obj.getHost());
+        assertNull(obj.getPort());
+    }
 
        public void testRemoveNonExisting() {
                final SetterConfiguration config = new SetterConfiguration(X6.class);