public abstract class SpincastGuiceBasedTestBase extends Object implements IBeforeAfterClassMethodsProvider
Uses a custom Junit runner,
OneInstancePerClassJUnitRunner.
This runner create a single instance of the test class for all of its tests,
instead of a new instance for each test. It also calls a beforeClass()
method before the tests are run and an afterClass() method after
they are run.
A class extending this will be part of a Guice context
(created using the createInjector method) and
the required dependencies will be injected into it.
| Constructor and Description |
|---|
SpincastGuiceBasedTestBase() |
| Modifier and Type | Method and Description |
|---|---|
void |
afterClass()
Called after the tests of the class are ran.
|
void |
beforeClass()
Called before the tests of the class are ran.
|
protected abstract com.google.inject.Injector |
createInjector()
The test class must implement this method to create
the Guice injector.
|
protected String |
createTestingFilePath()
Create a temporary test file.
|
protected String |
createTestingFilePath(String relativePath)
Create a temporary test file, using the given relative path.
|
protected void |
deleteTempDir() |
protected com.google.inject.Injector |
extendGuiceInjector(com.google.inject.Injector baseInjector)
Allows to extend the base Guice injector
|
protected com.google.inject.Injector |
getInjector() |
protected ISpincastConfig |
getSpincastConfig() |
protected File |
getTestingWritableDir() |
protected String |
getTestingWritableDirBasePath() |
protected void |
setSpincastConfig(ISpincastConfig spincastConfig) |
public void beforeClass()
IBeforeAfterClassMethodsProviderbeforeClass in interface IBeforeAfterClassMethodsProviderprotected com.google.inject.Injector extendGuiceInjector(com.google.inject.Injector baseInjector)
public void afterClass()
IBeforeAfterClassMethodsProviderafterClass in interface IBeforeAfterClassMethodsProvider@Inject protected void setSpincastConfig(ISpincastConfig spincastConfig)
protected ISpincastConfig getSpincastConfig()
protected com.google.inject.Injector getInjector()
protected void deleteTempDir()
protected File getTestingWritableDir()
protected String getTestingWritableDirBasePath()
protected String createTestingFilePath(String relativePath)
protected String createTestingFilePath()
protected abstract com.google.inject.Injector createInjector()
main(...) method) or by
creating a custom Injector.Copyright © 2016. All rights reserved.