Skip to content

Instantly share code, notes, and snippets.

@sebastianbenz
Created October 23, 2012 15:50
Show Gist options
  • Save sebastianbenz/3939592 to your computer and use it in GitHub Desktop.
Save sebastianbenz/3939592 to your computer and use it in GitHub Desktop.
Using Spring with Jnario
package example;
import org.jnario.lib.AbstractSpecCreator;
import org.jnario.runner.SpecCreator;
import org.springframework.test.context.TestContextManager;
public class SpringSupport extends AbstractSpecCreator{
private TestContextManager testContextManager;
@Override
protected <T> T create(Class<T> test) {
Object testInstance = super.create(test);
getTestContextManager().prepareTestInstance(testInstance);
return testInstance;
}
protected TestContextManager createTestContextManager(Class<?> clazz) {
return new TestContextManager(clazz, null);
}
protected final TestContextManager getTestContextManager(Class<?> clazz) {
if(testContextManager == null){
testContextManager = createTestContextManager(clazz);
}
return this.testContextManager;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment