MentaContainer

Compare Revisions

Regard whitespace Rev 92 → Rev 93

/trunk/src/test/java/org/mentacontainer/impl/ClassFactoryTest.java
30,10 → 30,12
@Test
public void testFactory() {
Factory c1 = new ClassFactory(User.class).addInitValue("saoj");
Container container = new MentaContainer();
Factory c2 = new ClassFactory(User.class).addPropertyValue("username", "soliveira");
Factory c1 = new ClassFactory(container, User.class).addInitValue("saoj");
Factory c2 = new ClassFactory(container, User.class).addPropertyValue("username", "soliveira");
User u1 = c1.getInstance();
User u2 = c2.getInstance();
116,8 → 118,10
@Test
public void testPrimitivePropertyValue1() {
Factory f = new ClassFactory(TestObj2.class).addPropertyValue("integer", 20);
Container container = new MentaContainer();
Factory f = new ClassFactory(container, TestObj2.class).addPropertyValue("integer", 20);
TestObj2 o = f.getInstance();
Assert.assertEquals(20, o.x);
126,8 → 130,10
@Test
public void testPrimitivePropertyValue2() {
Factory f = new ClassFactory(TestObj2.class).addPropertyValue("integer", new Integer(20));
Container container = new MentaContainer();
Factory f = new ClassFactory(container, TestObj2.class).addPropertyValue("integer", new Integer(20));
TestObj2 o = f.getInstance();
Assert.assertEquals(20, o.x);
147,8 → 153,10
@Test
public void testPrimitivePropertyValue3() {
Factory f = new ClassFactory(TestObj2_1.class).addPropertyValue("integer", 20);
Container container = new MentaContainer();
Factory f = new ClassFactory(container, TestObj2_1.class).addPropertyValue("integer", 20);
TestObj2_1 o = f.getInstance();
Assert.assertEquals(20, o.x);
157,8 → 165,10
@Test
public void testPrimitivePropertyValue4() {
Factory f = new ClassFactory(TestObj2_1.class).addPropertyValue("integer", new Integer(20));
Container container = new MentaContainer();
Factory f = new ClassFactory(container, TestObj2_1.class).addPropertyValue("integer", new Integer(20));
TestObj2_1 o = f.getInstance();
Assert.assertEquals(20, o.x);
177,8 → 187,10
@Test
public void testPrimitiveInitValue1() {
Factory f = new ClassFactory(TestObj3.class).addInitValue(20);
Container container = new MentaContainer();
Factory f = new ClassFactory(container, TestObj3.class).addInitValue(20);
TestObj3 o = f.getInstance();
Assert.assertEquals(20, o.x);
196,8 → 208,10
@Test
public void testPrimitiveInitValue2() {
Factory f = new ClassFactory(TestObj3_1.class).addInitValue(20);
Container container = new MentaContainer();
Factory f = new ClassFactory(container, TestObj3_1.class).addInitValue(20);
TestObj3_1 o = f.getInstance();
Assert.assertEquals(20, o.x);
217,8 → 231,10
@Test
public void testPrimitiveInitValue3() {
Factory f = new ClassFactory(TestObj3_2.class).addInitValue(20).addInitPrimitive(30L);
Container container = new MentaContainer();
Factory f = new ClassFactory(container, TestObj3_2.class).addInitValue(20).addInitPrimitive(30L);
TestObj3_2 o = f.getInstance();
Assert.assertEquals(20, o.x);
243,8 → 259,10
@Test
public void testMixInitValues() {
Factory f = new ClassFactory(TestObj4.class).addInitPrimitive(20).addInitValue("hello").addInitValue(20L).addInitPrimitive(20L);
Container container = new MentaContainer();
Factory f = new ClassFactory(container, TestObj4.class).addInitPrimitive(20).addInitValue("hello").addInitValue(20L).addInitPrimitive(20L);
TestObj4 o = f.getInstance();
Assert.assertEquals(20, o.x);