Пример #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})));
 }
Пример #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());
 }
Пример #3
0
  public void perform(ClassLoader loader) throws Throwable {

    KeyFactory.create(loader, MyKey.class, null);
  }
Пример #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()));
 }
Пример #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));
 }
Пример #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));
 }