public class GuiceMyBatisRollbackJUnitRunner
extends org.junit.runners.BlockJUnit4ClassRunner
@RunWith(MyBatisTestRollbackRunner.class)
public class UserDaoTest implements MyBatisModuleProvider {
@Inject
private UserDao userDao;
@Override
public MyBatisModule getMyBatisModule() {
return new PooledJdbcMyBatisModule() {
@Override
public void initializeForTest() {
addMapperClass(UserMapper.class);
addMapperClass(AddressMapper.class);
}
};
}
@Test
...
}
@ImplementedBy(UserDaoMyBatis.class)
public interface UserDao {
...
}
public class UserDaoMyBatis implements UserDao {
@Inject
private UserMapper userMapper;
@Inject
private AddressMapper addressMapper;
...
}
| Constructor and Description |
|---|
GuiceMyBatisRollbackJUnitRunner(Class<?> klass)
Instances a new JUnit runner.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
createTest()
Fills the test and injects the required interceptors
|
protected org.junit.runners.model.Statement |
methodInvoker(org.junit.runners.model.FrameworkMethod method,
Object test) |
collectInitializationErrors, computeTestMethods, describeChild, getChildren, getTestRules, isIgnored, methodBlock, possiblyExpectingExceptions, rules, runChild, testName, validateConstructor, validateFields, validateInstanceMethods, validateNoNonStaticInnerClass, validateOnlyOneConstructor, validateTestMethods, validateZeroArgConstructor, withAfters, withBefores, withPotentialTimeoutpublic GuiceMyBatisRollbackJUnitRunner(Class<?> klass) throws org.junit.runners.model.InitializationError
klass - The test classorg.junit.runners.model.InitializationError - In case of an error while initializing the classprotected org.junit.runners.model.Statement methodInvoker(org.junit.runners.model.FrameworkMethod method,
Object test)
methodInvoker in class org.junit.runners.BlockJUnit4ClassRunnerBlockJUnit4ClassRunner.methodInvoker(org.junit.runners.model.FrameworkMethod, java.lang.Object)Copyright © 2015. All Rights Reserved.