public abstract class AbstractDatabaseResource<PersistenceContext extends TopiaPersistenceContext,ApplicationContext extends AbstractTopiaApplicationContext<PersistenceContext>>
extends org.junit.rules.TestWatcher
public class MyTest {
\@Rule
public final TopiaDatabase db = new TopiaDatabase();
\@Test
public void testMethod() throws TopiaException {
TopiaContext tx = db.beginTransaction();
...
}
The db created will be unique for each test method (and for each build also).
You don't need to close any transaction, it will be done for you and the end
of each method test.
Created on 11/22/13.| Modifier and Type | Field and Description |
|---|---|
protected ApplicationContext |
applicationContext |
protected TopiaConfiguration |
topiaConfiguration |
| Constructor and Description |
|---|
AbstractDatabaseResource() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract ApplicationContext |
createApplicationContext(TopiaConfiguration topiaConfiguration) |
void |
finished(org.junit.runner.Description description) |
ApplicationContext |
getApplicationContext() |
TopiaConfiguration |
getTopiaConfiguration() |
PersistenceContext |
newPersistenceContext() |
protected void |
starting(org.junit.runner.Description description) |
protected ApplicationContext extends AbstractTopiaApplicationContext<PersistenceContext> applicationContext
protected TopiaConfiguration topiaConfiguration
protected abstract ApplicationContext createApplicationContext(TopiaConfiguration topiaConfiguration)
protected void starting(org.junit.runner.Description description)
starting in class org.junit.rules.TestWatcherpublic void finished(org.junit.runner.Description description)
finished in class org.junit.rules.TestWatcherpublic ApplicationContext getApplicationContext()
public PersistenceContext newPersistenceContext()
public TopiaConfiguration getTopiaConfiguration()
Copyright © 2004–2016 CodeLutin. All rights reserved.