Spring Framework TestContextManager - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework TestContextManager class.

This code example shows how to use the following methods:getTestExecutionListeners, registerTestExecutionListeners
     * testing features. 
     */ 
    public static final class CamelTestContextManager extends TestContextManager { 
 
        public CamelTestContextManager(Class<?> testClass) { 
            super(testClass); 
 
            // inject Camel first, and then disable jmx and add the stop-watch 
            List<TestExecutionListener> list = getTestExecutionListeners(); 
            list.add(new CamelSpringTestContextLoaderTestExecutionListener()); 
            list.add(new DisableJmxTestExecutionListener()); 
            list.add(new StopWatchTestExecutionListener()); 
            OrderComparator.sort(list); 
            registerTestExecutionListeners(list); 
        } 
 
    } 
 
} 
7
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:prepareTestInstance
	} 
 
	private final class MockTestContextManager extends TestContextManager {
 
		private MockTestContextManager(Object target, Class<?> testClass) throws Exception {
			super(testClass);
			prepareTestInstance(target);
		} 
 
		public TestContext getContext() {
			return getTestContext(); 
		} 
 
	} 
 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:beforeTestClass
	 * {@link Statement} in the execution chain (typically an instance of 
	 * {@link org.junit.internal.runners.statements.RunBefores RunBefores}). 
	 */ 
	@Override 
	public void evaluate() throws Throwable {
		this.testContextManager.beforeTestClass();
		this.next.evaluate();
	} 
 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
	private final TestContextManager testContextManager;
 
 
	public ParameterizedDependencyInjectionTests(final String employeeBeanName, final String employeeName)
			throws Exception {
		this.testContextManager = new TestContextManager(getClass());
		this.employeeBeanName = employeeBeanName;
		this.employeeName = employeeName;
	} 
 
	@Parameters 
	public static Collection<String[]> employeeData() {
		return Arrays.asList(new String[][] { { "employee1", "John Smith" }, { "employee2", "Jane Smith" } });
	} 
 
	@BeforeClass 
	public static void clearEmployees() { 
		employees.clear();
	} 
 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:beforeTestMethod
	 * the next {@link Statement} in the execution chain (typically an instance of 
	 * {@link org.junit.internal.runners.statements.RunBefores RunBefores}). 
	 */ 
	@Override 
	public void evaluate() throws Throwable {
		this.testContextManager.beforeTestMethod(this.testInstance, this.testMethod);
		this.next.evaluate();
	} 
 
} 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:afterTestClass
		catch (Throwable e) {
			errors.add(e);
		} 
 
		try { 
			this.testContextManager.afterTestClass();
		} 
		catch (Exception e) {
			errors.add(e);
		} 
 
		if (errors.isEmpty()) {
			return; 
		} 
		if (errors.size() == 1) {
			throw errors.get(0);
		} 
		throw new MultipleFailureException(errors);
	} 
 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:afterTestMethod
			testException = e;
			errors.add(e);
		} 
 
		try { 
			this.testContextManager.afterTestMethod(this.testInstance, this.testMethod, testException);
		} 
		catch (Exception e) {
			errors.add(e);
		} 
 
		if (errors.isEmpty()) {
			return; 
		} 
		if (errors.size() == 1) {
			throw errors.get(0);
		} 
		throw new MultipleFailureException(errors);
	} 
 
6
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
      ReflectionUtil.getMethodBySignature(TestContextManager.class, "afterTestClass");
 
  private final TestContextManager delegate;
 
  public SpringTestContextManager(Class<?> testClass) {
    delegate = new TestContextManager(testClass);
  } 
 
  public void beforeTestClass() throws Exception {
    if (beforeTestClassMethod != null)
      ReflectionUtil.invokeMethod(delegate, beforeTestClassMethod);
  } 
 
  public void afterTestClass() throws Exception {
    if (afterTestClassMethod != null)
      ReflectionUtil.invokeMethod(delegate, afterTestClassMethod);
  } 
 
  public void prepareTestInstance(Object testInstance) throws Exception {
    delegate.prepareTestInstance(testInstance);
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
	/** 
	 * Construct a new AbstractTestNGSpringContextTests instance and initialize 
	 * the internal {@link TestContextManager} for the current test. 
	 */ 
	public AbstractTestNGSpringContextTests() { 
		this.testContextManager = new TestContextManager(getClass());
	} 
 
	/** 
	 * Set the {@link ApplicationContext} to be used by this test instance, 
	 * provided via {@link ApplicationContextAware} semantics. 
	 * 
	 * @param applicationContext the ApplicationContext that this test runs in 
	 */ 
	@Override 
	public final void setApplicationContext(ApplicationContext applicationContext) {
		this.applicationContext = applicationContext;
	} 
 
	/** 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:
            return false; 
        } 
    } 
 
    protected TestContextManager getTestContextManager(Class<?> clazz) {
        return new TestContextManager(clazz);
    } 
} 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Spring Framework TestContextManager Methods: