Created
October 23, 2012 15:50
-
-
Save sebastianbenz/3939592 to your computer and use it in GitHub Desktop.
Using Spring with Jnario
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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