Class MockMethodAdvice
java.lang.Object
org.mockito.internal.creation.bytebuddy.inject.MockMethodDispatcher
org.mockito.internal.creation.bytebuddy.MockMethodAdvice
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class
(package private) static class
(package private) static class
static class
(package private) static class
(package private) static @interface
private static class
private static class
private static class
private static class
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final net.bytebuddy.dynamic.scaffold.MethodGraph.Compiler
private final WeakConcurrentMap<Class<?>,
SoftReference<net.bytebuddy.dynamic.scaffold.MethodGraph>> private final String
private final WeakConcurrentMap<Object,
MockMethodInterceptor> private final DetachedThreadLocal<Map<Class<?>,
MockMethodInterceptor>> private final ConstructionCallback
private final MockMethodAdvice.SelfCallInfo
-
Constructor Summary
ConstructorsConstructorDescriptionMockMethodAdvice
(WeakConcurrentMap<Object, MockMethodInterceptor> interceptors, DetachedThreadLocal<Map<Class<?>, MockMethodInterceptor>> mockedStatics, String identifier, Predicate<Class<?>> isMockConstruction, ConstructionCallback onConstruction) -
Method Summary
Modifier and TypeMethodDescriptionprivate static Callable<?>
private static void
Callable<?>
handleConstruction
(Class<?> type, Object object, Object[] arguments, String[] parameterTypeNames) Callable<?>
handleStatic
(Class<?> type, Method origin, Object[] arguments) (package private) static Throwable
hideRecursiveCall
(Throwable throwable, int current, Class<?> targetType) boolean
isConstructorMock
(Class<?> type) boolean
boolean
boolean
isMockedStatic
(Class<?> type) boolean
isOverridden
(Object instance, Method origin) private static Object
Methods inherited from class org.mockito.internal.creation.bytebuddy.inject.MockMethodDispatcher
get, getStatic, handleConstruction, isConstructorMock, set
-
Field Details
-
interceptors
-
mockedStatics
-
identifier
-
selfCallInfo
-
compiler
private final net.bytebuddy.dynamic.scaffold.MethodGraph.Compiler compiler -
graphs
private final WeakConcurrentMap<Class<?>,SoftReference<net.bytebuddy.dynamic.scaffold.MethodGraph>> graphs -
isMockConstruction
-
onConstruction
-
-
Constructor Details
-
MockMethodAdvice
public MockMethodAdvice(WeakConcurrentMap<Object, MockMethodInterceptor> interceptors, DetachedThreadLocal<Map<Class<?>, MockMethodInterceptor>> mockedStatics, String identifier, Predicate<Class<?>> isMockConstruction, ConstructionCallback onConstruction)
-
-
Method Details
-
enter
@OnMethodEnter(skipOn=net.bytebuddy.asm.Advice.OnNonDefaultValue.class) private static Callable<?> enter(String identifier, @This Object mock, @Origin Method origin, @AllArguments Object[] arguments) throws Throwable - Throws:
Throwable
-
exit
@OnMethodExit private static void exit(@Return(readOnly=false,typing=DYNAMIC) Object returned, @Enter Callable<?> mocked) throws Throwable - Throws:
Throwable
-
hideRecursiveCall
-
handle
- Specified by:
handle
in classMockMethodDispatcher
- Throws:
Throwable
-
handleStatic
- Specified by:
handleStatic
in classMockMethodDispatcher
- Throws:
Throwable
-
handleConstruction
public Object handleConstruction(Class<?> type, Object object, Object[] arguments, String[] parameterTypeNames) - Specified by:
handleConstruction
in classMockMethodDispatcher
-
isMock
- Specified by:
isMock
in classMockMethodDispatcher
-
isMocked
- Specified by:
isMocked
in classMockMethodDispatcher
-
isMockedStatic
- Specified by:
isMockedStatic
in classMockMethodDispatcher
-
isOverridden
- Specified by:
isOverridden
in classMockMethodDispatcher
-
isConstructorMock
- Specified by:
isConstructorMock
in classMockMethodDispatcher
-
tryInvoke
private static Object tryInvoke(Method origin, Object instance, Object[] arguments) throws Throwable - Throws:
Throwable
-