/** verify Identity(String, IdentityScope) creates instance with given name and in give scope */ public void testIdentityStringIdentityScope() throws Exception { IdentityScope s = IdentityScope.getSystemScope(); Identity i = new IdentityStub("iii2", s); assertNotNull(i); assertEquals("iii2", i.getName()); assertSame(s, i.getScope()); assertSame(i, s.getIdentity(i.getName())); }
/* * verify Identity(String) creates instance with given name */ public void testIdentityString() { Identity i = new IdentityStub("iii"); assertNotNull(i); assertEquals("iii", i.getName()); i = new IdentityStub(null); assertNotNull(i); assertNull(i.getName()); }
public void testEquals() throws Exception { Identity i1 = new IdentityStub("testEquals"); Object value[] = { null, Boolean.FALSE, new Object(), Boolean.FALSE, i1, Boolean.TRUE, new IdentityStub(i1.getName()), Boolean.TRUE }; for (int k = 0; k < value.length; k += 2) { assertEquals(value[k + 1], new Boolean(i1.equals(value[k]))); if (Boolean.TRUE.equals(value[k + 1])) assertEquals(i1.hashCode(), value[k].hashCode()); } // check other cases Identity i2 = new IdentityStub("testEquals", IdentityScope.getSystemScope()); assertEquals(i1.identityEquals(i2), i1.equals(i2)); Identity i3 = new IdentityStub("testEquals3"); assertEquals(i1.identityEquals(i3), i1.equals(i3)); }
public void testGetName() { Identity i = new IdentityStub("testGetName"); assertEquals("testGetName", i.getName()); }