Example #1
0
 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})));
 }
Example #2
0
 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());
 }
Example #3
0
  public void perform(ClassLoader loader) throws Throwable {

    KeyFactory.create(loader, MyKey.class, null);
  }
Example #4
0
 public void testEqualOtherClass() throws Exception {
   MyKey mykey = (MyKey) KeyFactory.create(MyKey.class);
   assertTrue(!mykey.newInstance(5, new int[] {6, 7}, false).equals(new Object()));
 }
Example #5
0
 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));
 }
Example #6
0
 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));
 }