DbUnitDatabaseConnectionDecorator implements TestClassDecorator { @Override public void beforeAll(final TestInvocation invocation) throws Exception { final ExecutionContext context = invocation.getContext(); final BasicDataSource ds = (BasicDataSource) context.getData(Constants.KEY_DATA_SOURCE); final IDatabaseConnection connection = DatabaseConnectionFactory.openConnection(ds); connection.getConfig().setPropertiesByString( DbUnitConfigurationLoader.loadConfiguration(ResourceLocator.getResource("dbunit.properties"))); context.storeData(Constants.KEY_CONNECTION, connection); }  @Override int getPriority(); @Override boolean isConfigurationSupported(final ExecutionContext ctx); @Override void beforeAll(final TestInvocation invocation); @Override void afterAll(final TestInvocation invocation);  }
@Test public void testBeforeAll() throws Throwable { decorator.beforeAll(invocation); verify(ctx).storeData(eq(Constants.KEY_CONNECTION), eq(connection)); }