MentaContainer

Compare Revisions

Ignore whitespace Rev 57 → Rev 58

/trunk/src/test/java/org/mentacontainer/impl/MentaContainerTest.java
70,6 → 70,32
Assert.assertTrue(s1.equals(s2));
}
@Test
public void testCheckAndClear() {
Container c = new MentaContainer();
c.ioc("myStr", String.class, Scope.SINGLETON).addInitValue("hello");
 
Assert.assertEquals(false, c.check("myStr"));
String s1 = c.get("myStr");
Assert.assertEquals(true, c.check("myStr"));
String s2 = c.get("myStr");
Assert.assertTrue(s1 == s2);
c.clear(Scope.SINGLETON);
Assert.assertEquals(false, c.check("myStr"));
String s3 = c.get("myStr");
Assert.assertTrue(s3 != s2);
}
private static class MyThread extends Thread {
private final Container c;