MentaContainer

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
70 soliveira 1
package org.mentacontainer.impl;
2
 
3
import junit.framework.Assert;
4
 
5
import org.junit.Test;
6
import org.mentacontainer.Component;
7
import org.mentacontainer.Container;
8
 
9
public class InstanceComponentTest {
10
 
11
        @Test
12
        public void testInstanceComponent() throws Exception {
13
 
14
                String s = new String("saoj");
15
 
16
                Component ic = new InstanceComponent(s);
17
 
18
                Container c = new MentaContainer();
19
 
20
                c.ioc("myString", ic);
21
 
22
                String s1 = c.get("myString");
23
 
24
                String s2 = c.get("myString");
25
 
26
                Assert.assertNotNull(s1);
27
                Assert.assertNotNull(s2);
28
                Assert.assertTrue(s == s1);
29
                Assert.assertTrue(s1 == s2);
30
        }
31
}