git://wamblee.org
/
xmlrouter
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
removed the prefix argument from ConfigImpl.wrap().
[xmlrouter]
/
impl
/
src
/
test
/
java
/
org
/
wamblee
/
xmlrouter
/
impl
/
ConfigImplTest.java
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 aa197eaf54274e44fee6d9ba87555d0381833735..9925c0b74a7637aa6065cca0cd7a49a7f597474f 100644
(file)
--- a/
impl/src/test/java/org/wamblee/xmlrouter/impl/ConfigImplTest.java
+++ b/
impl/src/test/java/org/wamblee/xmlrouter/impl/ConfigImplTest.java
@@
-35,11
+35,9
@@
public class ConfigImplTest {
}
private static class MyTypeWrapper implements MyType {
}
private static class MyTypeWrapper implements MyType {
- private String prefix;
private MyType type;
private MyType type;
- public MyTypeWrapper(String aPrefix, MyType aType) {
- prefix = aPrefix;
+ public MyTypeWrapper(MyType aType) {
type = aType;
}
type = aType;
}
@@
-49,13
+47,13
@@
public class ConfigImplTest {
@Override
public Id getId() {
@Override
public Id getId() {
- return
new Id(prefix + type.getId().getId()
);
+ return
type.getId(
);
}
}
public static final class MyTypeConfig extends ConfigImpl<MyType> {
public MyTypeConfig(Id<Config> aId) {
}
}
public static final class MyTypeConfig extends ConfigImpl<MyType> {
public MyTypeConfig(Id<Config> aId) {
- super(aId);
+ super(
MyType.class,
aId);
}
public MyTypeConfig(MyTypeConfig aConfig) {
}
public MyTypeConfig(MyTypeConfig aConfig) {
@@
-63,8
+61,8
@@
public class ConfigImplTest {
}
@Override
}
@Override
- public MyType wrap(
String aPrefix,
MyType aT) {
- return new MyTypeWrapper(a
Prefix, a
T);
+ public MyType wrap(MyType aT) {
+ return new MyTypeWrapper(aT);
}
}
}
}
@@
-89,8
+87,7
@@
public class ConfigImplTest {
assertTrue(firstValue instanceof MyTypeWrapper);
assertSame(type1, ((MyTypeWrapper) firstValue).getType());
assertTrue(firstValue instanceof MyTypeWrapper);
assertSame(type1, ((MyTypeWrapper) firstValue).getType());
- assertEquals(CONFIG_TYPE + "." + type1.getId().getId(), firstValue
- .getId().getId());
+ assertEquals(type1.getId().getId(), firstValue.getId().getId());
// add another one.
MyType type2 = mock(MyType.class);
// add another one.
MyType type2 = mock(MyType.class);
@@
-121,22
+118,11
@@
public class ConfigImplTest {
@Test
public void testEquals() {
@Test
public void testEquals() {
- Config<MyType> config1 = new ConfigImpl<MyType>(new Id<Config>(
- CONFIG_TYPE)) {
- @Override
- public MyType wrap(String aPrefix, MyType aT) {
- return new MyTypeWrapper(aPrefix, aT);
- }
- };
+ Config<MyType> config1 = new MyTypeConfig(new Id<Config>(CONFIG_TYPE));
assertFalse(config1.equals(null));
assertFalse(config1.equals("hello"));
assertFalse(config1.equals(null));
assertFalse(config1.equals("hello"));
- Config<MyType> config2 = new ConfigImpl<MyType>(new Id<Config>(
- CONFIG_TYPE)) {
- @Override
- public MyType wrap(String aPrefix, MyType aT) {
- return new MyTypeWrapper(aPrefix, aT);
- }
- };
+ Config<MyType> config2 = new MyTypeConfig(new Id<Config>(CONFIG_TYPE));
+
assertEquals(config1, config2);
assertEquals(config1.hashCode(), config2.hashCode());
assertEquals(config1, config2);
assertEquals(config1.hashCode(), config2.hashCode());