public abstract class JukitoModule extends TestModule
Module
with a bit of syntactic sugar
to bind within typical test scopes. Depends on mockito. This module
automatically mocks any interface or abstract class dependency for which a
binding is not explicitly provided. Any concrete class for which a binding is
not explicitly provided is bound as a TestScope.SINGLETON
.
Depends on Mockito.Modifier and Type | Field and Description |
---|---|
protected List<BindingsCollector.BindingInfo> |
bindingsObserved |
testClass
Constructor and Description |
---|
JukitoModule() |
Modifier and Type | Method and Description |
---|---|
void |
configure() |
protected void |
forceMock(Class<?> klass)
By default, only abstract classes, interfaces and classes annotated with
TestMockSingleton are automatically mocked. |
Writer |
getReportWriter()
Override and return the
Writer you want to use to report the tree of test objects,and whether they
were mocked, spied, automatically instantiated, or explicitly bound. |
void |
printReport(List<BindingsCollector.BindingInfo> allBindings)
Outputs the report, see
#setReportWriter(Writer) . |
void |
setBindingsObserved(List<BindingsCollector.BindingInfo> bindingsObserved)
Attach this
JukitoModule to a list of the bindings that were
observed by a preliminary run of BindingsCollector . |
bindMany, bindMany, bindManyInstances, bindManyInstances, bindMock, bindMock, bindNamed, bindNamed, bindNamedMock, bindNamedMock, bindNamedSpy, bindNamedSpy, bindScopes, bindSpy, bindSpy, configureTest, setTestClass
addError, addError, addError, bind, bind, bind, bindConstant, binder, bindInterceptor, bindListener, bindScope, configure, convertToTypes, currentStage, getMembersInjector, getMembersInjector, getProvider, getProvider, install, requestInjection, requestStaticInjection, requireBinding, requireBinding
protected List<BindingsCollector.BindingInfo> bindingsObserved
public void setBindingsObserved(List<BindingsCollector.BindingInfo> bindingsObserved)
JukitoModule
to a list of the bindings that were
observed by a preliminary run of BindingsCollector
.bindingsObserved
- The observed bindings.protected void forceMock(Class<?> klass)
TestMockSingleton
are automatically mocked. Use forceMock
to indicate that all concrete classes derived from the a specific type
will be mocked in TestMockSingleton
scope.klass
- The Class
or interface for which all subclasses will
be mocked.public final void configure()
configure
in class TestModule
public Writer getReportWriter()
Writer
you want to use to report the tree of test objects,and whether they
were mocked, spied, automatically instantiated, or explicitly bound. Mostly useful for
debugging.Writer
, if null
no report will be output.public void printReport(List<BindingsCollector.BindingInfo> allBindings)
#setReportWriter(Writer)
. Will not output anything if the
reportWriter
is null
. Do not call directly, it will be called by
JukitoRunner
. To obtain a report, override getReportWriter()
.Copyright © 2010-2013 ArcBees Inc.. All Rights Reserved.