Package com.peterphi.std.guice.testing
Class AbstractTestModule
java.lang.Object
com.google.inject.AbstractModule
com.peterphi.std.guice.testing.AbstractTestModule
- All Implemented Interfaces:
com.google.inject.Module
public abstract class AbstractTestModule
extends com.google.inject.AbstractModule
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected <T> void
Create a custom binding for the provided class as a mockito mockprotected <T> void
bindNamedMock
(String name, Class<T> clazz) Create a named binding for the provided class as a mockito mockprotected <T> void
Create a binding for the provided class as a mockito mockMethods inherited from class com.google.inject.AbstractModule
addError, addError, addError, bind, bind, bind, bindConstant, binder, bindInterceptor, bindListener, bindListener, bindScope, configure, configure, convertToTypes, currentStage, getMembersInjector, getMembersInjector, getProvider, getProvider, install, requestInjection, requestStaticInjection, requireBinding, requireBinding
-
Constructor Details
-
AbstractTestModule
public AbstractTestModule()
-
-
Method Details
-
mock
Create a binding for the provided class as a mockito mock- Type Parameters:
T
-- Parameters:
clazz
-
-
bindNamedMock
Create a named binding for the provided class as a mockito mock- Type Parameters:
T
-- Parameters:
name
- shorthand for specifying aNamed
bindingclazz
-
-
bindMock
Create a custom binding for the provided class as a mockito mock- Type Parameters:
T
-- Parameters:
key
- the key to use for the bindingclazz
- the class to mockmockName
- the name for the mockito mock (note: not the name of the Guice binding. If none is specified then a default name will be created based on thekey
-