X-Git-Url: http://wamblee.org/gitweb/?a=blobdiff_plain;f=impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fwamblee%2Fxmlrouter%2Fimpl%2FConfigImplTest.java;fp=impl%2Fsrc%2Ftest%2Fjava%2Forg%2Fwamblee%2Fxmlrouter%2Fimpl%2FConfigImplTest.java;h=781a53acab9c3ef7a3e3fc051bc3fe5fff73f14d;hb=ca624324bf36e5ba8217a6af861cbf898a40adfc;hp=5e3ad92059625e3b4b5e1a5152da4ed0e9feefd1;hpb=e52385618670b54a5c6a4f2fbfab381bef43a905;p=xmlrouter diff --git a/impl/src/test/java/org/wamblee/xmlrouter/impl/ConfigImplTest.java b/impl/src/test/java/org/wamblee/xmlrouter/impl/ConfigImplTest.java index 5e3ad92..781a53a 100644 --- a/impl/src/test/java/org/wamblee/xmlrouter/impl/ConfigImplTest.java +++ b/impl/src/test/java/org/wamblee/xmlrouter/impl/ConfigImplTest.java @@ -28,14 +28,18 @@ import org.wamblee.xmlrouter.config.Identifiable; public class ConfigImplTest { + private static final String CONFIG_TYPE = "transformation"; + private static interface MyType extends Identifiable { } private static class MyTypeWrapper implements MyType { + private String prefix; private MyType type; - public MyTypeWrapper(MyType aType) { + public MyTypeWrapper(String aPrefix, MyType aType) { + prefix = aPrefix; type = aType; } @@ -45,7 +49,7 @@ public class ConfigImplTest { @Override public Id getId() { - return type.getId(); + return new Id(prefix + type.getId().getId()); } } @@ -55,10 +59,10 @@ public class ConfigImplTest { @Before public void setUp() { sequence = new AtomicLong(1L); - config = new ConfigImpl(new Id("mytype")) { + config = new ConfigImpl(new Id(CONFIG_TYPE)) { @Override - public MyType wrap(MyType aT) { - return new MyTypeWrapper(aT); + public MyType wrap(String aPrefix, MyType aT) { + return new MyTypeWrapper(aPrefix, aT); } }; } @@ -73,6 +77,8 @@ public class ConfigImplTest { assertEquals(1, config.values().size()); assertTrue(config.values().get(0) instanceof MyTypeWrapper); assertSame(type1, ((MyTypeWrapper) config.values().get(0)).getType()); + assertEquals(CONFIG_TYPE + "." + type1.getId().getId(), config.values() + .get(0).getId().getId()); // add another one. MyType type2 = mock(MyType.class); @@ -91,7 +97,7 @@ public class ConfigImplTest { assertEquals(1, config.values().size()); - assertTrue(config.remove(new Id("type1"))); + assertTrue(config.remove(new Id(CONFIG_TYPE + "." + "type1"))); assertTrue(config.values().isEmpty()); }