19,17 → 19,19 |
@Test |
public void testGenericComponent() throws Exception { |
|
// in real life this will be a SessionFactory, a ConnectionPool or any factory... |
SomeFactory factory = new SomeFactory(); |
|
Container c = new MentaContainer(); |
|
// giveMeSomething => method that will be called to return object |
Component generic = new GenericComponent("myFactory", factory, "giveMeSomething"); |
|
c.ioc(generic); |
|
String s1 = (String) c.get("myFactory"); |
|
Thread.sleep(5); |
Thread.sleep(5); // so strings are different... my cpu is fast! :-) |
|
String s2 = (String) c.get("myFactory"); |
|