public class ReturnValuesMutator extends Object implements MethodMutatorFactory
ReturnValuesMutator
mutates the return values of method
calls. Depending on the return type of the method another mutation is used.
Replacements for primitive types are simple. Replacements of object references are handled by ObjectReferenceReplacer. Those replacements can get more complex.
Constructor and Description |
---|
ReturnValuesMutator() |
Modifier and Type | Method and Description |
---|---|
org.objectweb.asm.MethodVisitor |
create(MutationContext context,
MethodInfo methodInfo,
org.objectweb.asm.MethodVisitor methodVisitor) |
String |
getGloballyUniqueId() |
String |
getName()
Returns a human readable
String representation of this
MethodMutatorFactory . |
static Object |
mutateObjectInstance(Object object,
Class<?> clazz)
Mutates a given object instance / reference.
|
public static Object mutateObjectInstance(Object object, Class<?> clazz)
object
may be null
. The class given as second
parameter clazz
will be the class of the object
or one of it's super classes. The returned object must be of type
clazz
or one of it's child classes.object
- the object reference to mutate, maybe null
.clazz
- the type the returned object must have. Usually that's also the
type of object
but might be a super type of
object
.null
).public org.objectweb.asm.MethodVisitor create(MutationContext context, MethodInfo methodInfo, org.objectweb.asm.MethodVisitor methodVisitor)
create
in interface MethodMutatorFactory
public String getGloballyUniqueId()
getGloballyUniqueId
in interface MethodMutatorFactory
public String getName()
MethodMutatorFactory
String
representation of this
MethodMutatorFactory
. The return value of this method will be
used in reports to document and describe the mutation(s) applied by the
MethodVisitor
created by this
MethodMutatorFactory
.getName
in interface MethodMutatorFactory
Copyright © 2021 org.pitest. All rights reserved.