コード例 #1
0
 public static void clearFields(final Object test) throws IllegalAccessException {
   Class aClass = test.getClass();
   while (aClass != null) {
     clearDeclaredFields(test, aClass);
     aClass = aClass.getSuperclass();
   }
 }
コード例 #2
0
ファイル: LightPlatformTestCase.java プロジェクト: jexp/idea2
  private void resetClassFields(final Class<?> aClass) {
    try {
      UsefulTestCase.clearDeclaredFields(this, aClass);
    } catch (IllegalAccessException e) {
      throw new RuntimeException(e);
    }

    if (aClass == LightPlatformTestCase.class) return;
    resetClassFields(aClass.getSuperclass());
  }
コード例 #3
0
 protected boolean annotatedWith(@NotNull Class annotationClass) {
   Class<?> aClass = getClass();
   String methodName = "test" + getTestName(false);
   boolean methodChecked = false;
   while (aClass != null && aClass != Object.class) {
     if (aClass.getAnnotation(annotationClass) != null) return true;
     if (!methodChecked) {
       try {
         Method method = aClass.getDeclaredMethod(methodName);
         if (method.getAnnotation(annotationClass) != null) return true;
         methodChecked = true;
       } catch (NoSuchMethodException ignored) {
       }
     }
     aClass = aClass.getSuperclass();
   }
   return false;
 }