public void testMethodKey() throws Exception { MethodKey factory = (MethodKey) KeyFactory.create(MethodKey.class); Set methodSet = new HashSet(); methodSet.add(factory.newInstance(Number.class, new Class[] {int.class})); assertTrue(methodSet.contains(factory.newInstance(Number.class, new Class[] {int.class}))); assertTrue(!methodSet.contains(factory.newInstance(Number.class, new Class[] {Integer.class}))); }
public void testSimple() throws Exception { MyKey mykey = (MyKey) KeyFactory.create(MyKey.class); assertTrue( mykey.newInstance(5, new int[] {6, 7}, false).hashCode() == mykey.newInstance(5, new int[] {6, 7}, false).hashCode()); }
public void perform(ClassLoader loader) throws Throwable { KeyFactory.create(loader, MyKey.class, null); }
public void testEqualOtherClass() throws Exception { MyKey mykey = (MyKey) KeyFactory.create(MyKey.class); assertTrue(!mykey.newInstance(5, new int[] {6, 7}, false).equals(new Object())); }
public void testBooleanArray() throws Exception { BooleanArrayKey f = (BooleanArrayKey) KeyFactory.create(BooleanArrayKey.class); Object key1 = f.newInstance(new boolean[] {true, false, true}); Object key2 = f.newInstance(new boolean[] {true, false, true}); assertTrue(key1.equals(key2)); }
public void testCharArray() throws Exception { CharArrayKey f = (CharArrayKey) KeyFactory.create(CharArrayKey.class); Object key1 = f.newInstance(new char[] {'a', 'b'}); Object key2 = f.newInstance(new char[] {'a', '_'}); assertTrue(!key1.equals(key2)); }