org.qi4j.core.testsupport
Class AbstractQi4jMultipleRunTest
java.lang.Object
org.qi4j.core.testsupport.AbstractQi4jTest
org.qi4j.core.testsupport.AbstractQi4jMultipleRunTest
- All Implemented Interfaces:
- Assembler
public class AbstractQi4jMultipleRunTest
- extends AbstractQi4jTest
This abstract test helper is for running the same set of tests but with different Assemblers.
To use it, you need to provide a @Parameters
annotated method in your test class, which
returns a Collection of an array of arguments for your constructor.
Your constructor should either call this class' constructor of Assembler
or ApplicationAssembler
.
Example;
public class MyTest
extends AbstractQi4jMultipleRunTest
{
private String someValue;
public MyTest( Assembler assembler, String value )
{
super( assembler );
this.someValue = value;
}
@Parameterized.Parameters
public static Collection<Object[]> configuration()
{
ArrayList<Object[]> result = new ArrayList<Object[]>();
result.add( new Object[]{ new TestAssembler( "Niclas" ), "1" } );
result.add( new Object[]{ new TestAssembler( "Hedhman" ), "2" } );
return result;
}
@Test
public void ....
Fields inherited from class org.qi4j.core.testsupport.AbstractQi4jTest |
api, application, applicationModel, moduleInstance, objectBuilderFactory, qi4j, queryBuilderFactory, serviceLocator, spi, transientBuilderFactory, unitOfWorkFactory, valueBuilderFactory |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractQi4jMultipleRunTest
protected AbstractQi4jMultipleRunTest(ApplicationAssembler assembler)
AbstractQi4jMultipleRunTest
protected AbstractQi4jMultipleRunTest(Assembler assembler)
assemble
public void assemble(ModuleAssembly module)
throws AssemblyException
- Description copied from interface:
Assembler
- Assemblers receive a callback to the ModuleAssembly
they are supposed to configure. They can use this
to register objects, composites, services etc. and
the additional metadata that may exist for these
artifacts.
An Assembler may create new Modules by calling
ModuleAssembly.layer()
and
then LayerAssembly.module(String)
(String)}.
This allows an Assembler to bootstrap an entire Layer with
more Modules.
- Parameters:
module
- the Module to assemble
- Throws:
AssemblyException
- thrown if the assembler tries to do something illegal
createApplicationAssembler
protected ApplicationAssembler createApplicationAssembler()
- Overrides:
createApplicationAssembler
in class AbstractQi4jTest