MentaContainer

Compare Revisions

Ignore whitespace Rev 91 → Rev 92

/trunk/src/test/java/org/mentacontainer/impl/ClassFactoryTest.java
196,14 → 196,35
@Test
public void testPrimitiveInitValue2() {
Factory f = new ClassFactory(TestObj3_1.class).addInitValue(new Integer(20));
Factory f = new ClassFactory(TestObj3_1.class).addInitValue(20);
TestObj3_1 o = f.getInstance();
Assert.assertEquals(20, o.x);
}
private static class TestObj3_2 {
int x;
long l;
public TestObj3_2(Integer x, long l) {
this.x = x;
this.l = l;
}
}
@Test
public void testPrimitiveInitValue3() {
Factory f = new ClassFactory(TestObj3_2.class).addInitValue(20).addInitPrimitive(30L);
TestObj3_2 o = f.getInstance();
Assert.assertEquals(20, o.x);
Assert.assertEquals(30L, o.l);
}
private static class TestObj4 {
int x;
222,7 → 243,7
@Test
public void testMixInitValues() {
Factory f = new ClassFactory(TestObj4.class).addInitValue(20).addInitValue("hello").addInitValue(new Long(20)).addInitValue(20L);
Factory f = new ClassFactory(TestObj4.class).addInitPrimitive(20).addInitValue("hello").addInitValue(20L).addInitPrimitive(20L);
TestObj4 o = f.getInstance();