Beispiel #1
0
 public void testShouldSuccessfullyGetAndSetValueOnBeanWithOverloadedSetter() throws Exception {
   BeanWithOverloadedSetter bean = new BeanWithOverloadedSetter();
   ClassInfo info = ClassInfo.getInstance(BeanWithOverloadedSetter.class);
   info.getSetter(PROPNAME).invoke(bean, STRING_PARAMS);
   assertEquals(STRING_VALUE, info.getGetter(PROPNAME).invoke(bean, NO_VALUE));
   assertEquals(String.class, info.getSetterType(PROPNAME));
   assertEquals(String.class, info.getGetterType(PROPNAME));
 }
Beispiel #2
0
 public void testShouldSuccessfullyGetAndSetValueOnBeanWithDifferentTypeGetterSetter()
     throws Exception {
   BeanWithDifferentTypeGetterSetter bean = new BeanWithDifferentTypeGetterSetter();
   ClassInfo info = ClassInfo.getInstance(BeanWithDifferentTypeGetterSetter.class);
   info.getSetter(PROPNAME).invoke(bean, INT_PARAMS);
   assertEquals(INT_VALUE.toString(), info.getGetter(PROPNAME).invoke(bean, NO_VALUE));
   assertEquals(Integer.class, info.getSetterType(PROPNAME));
   assertEquals(String.class, info.getGetterType(PROPNAME));
 }
Beispiel #3
0
 public void testShouldFailInitializingClassInfoForBeanWithDifferentTypeOverloadedSetter() {
   try {
     try {
       ClassInfo.getInstance(BeanWithDifferentTypeOverloadedSetter.class);
     } catch (Exception e) {
       assertTrue(
           e.getMessage()
                   .indexOf("Illegal overloaded setter method with ambiguous type for property")
               == 0);
       throw e;
     }
     fail("Expected exception.");
   } catch (Exception e) {
     // ignore
   }
 }
Beispiel #4
0
 public void testUnwrapThrowable() {
   SQLException cause = new SQLException("test");
   UndeclaredThrowableException e = new UndeclaredThrowableException(cause);
   assertEquals(cause, ClassInfo.unwrapThrowable(e));
 }