From a591aaa9ada684cf47656f405f5b88b95657ecf0 Mon Sep 17 00:00:00 2001 From: erik Date: Sun, 15 Nov 2009 10:41:14 +0000 Subject: [PATCH] --- .../adapters/SetterConfigurationTest.java | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/system/general/src/test/java/org/wamblee/system/adapters/SetterConfigurationTest.java b/system/general/src/test/java/org/wamblee/system/adapters/SetterConfigurationTest.java index 382beb36..34f06a38 100644 --- a/system/general/src/test/java/org/wamblee/system/adapters/SetterConfigurationTest.java +++ b/system/general/src/test/java/org/wamblee/system/adapters/SetterConfigurationTest.java @@ -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 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); -- 2.31.1