Package org.powermock.reflect.exceptions

Examples of org.powermock.reflect.exceptions.FieldNotFoundException


    try {
      field = where.getDeclaredField(fieldName);
      field.setAccessible(true);
      return (T) field.get(object);
    } catch (NoSuchFieldException e) {
      throw new FieldNotFoundException("Field '" + fieldName + "' was not found in class " + where.getName()
          + ".");
    } catch (Exception e) {
      throw new RuntimeException("Internal error: Failed to get field in method getInternalState.", e);
    }
  }
View Full Code Here


    }
  }

  public static void throwExceptionIfFieldWasNotFound(Class<?> type, String fieldName, Field field) {
    if (field == null) {
      throw new FieldNotFoundException("No field was found with name '" + fieldName + "' in class "
          + getUnmockedType(type).getName());
    }
  }
View Full Code Here

      }
    }

    final Field[] fieldArray = fields.toArray(new Field[fields.size()]);
    if (fieldArray.length == 0) {
      throw new FieldNotFoundException(String.format(
          "No fields matching the name(s) %s were found in the class hierarchy of %s.",
          concatenateStrings(fieldNames), getType(clazz)));
    }
    return fieldArray;
  }
View Full Code Here

    Field field = null;
    try {
      field = where.getDeclaredField(fieldName);
      field.setAccessible(true);
    } catch (NoSuchFieldException e) {
      throw new FieldNotFoundException("Field '" + fieldName + "' was not found in class " + where.getName()
          + ".");
    }
    return field;
  }
View Full Code Here

        field = currentField;
        break;
      }
    }
    if (field == null) {
      throw new FieldNotFoundException("Cannot find a field of type " + fieldType + "in where.");
    }
    return field;
  }
View Full Code Here

TOP

Related Classes of org.powermock.reflect.exceptions.FieldNotFoundException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.