Class DefaultFieldValueGenerator
java.lang.Object
org.powermock.core.DefaultFieldValueGenerator
Fills the fields with default not-null values. If a field type is an
interface a proxy returning default values for each method will be created.
If it's an abstract class a new concrete implementation of that type will
created and instantiated at run-time.
There are two scenarios where a field-type cannot possibly be assigned.
-
When a class contains a field of it's own type, which would lead to infinite
recursion,
nullis assigned. - When the field type is an abstract Java system class with no visible
constructor (package-private)
nullis assigned.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TfillWithDefaultValues(T object) private static ObjectinstantiateFieldType(Field field) private static booleanprivate static Class<?> substituteKnownProblemTypes(Class<?> fieldType) Substitute class types that are known to cause problems when generating them.
-
Constructor Details
-
DefaultFieldValueGenerator
public DefaultFieldValueGenerator()
-
-
Method Details
-
fillWithDefaultValues
public static <T> T fillWithDefaultValues(T object) -
instantiateFieldType
-
isClass
-
substituteKnownProblemTypes
-