Package org.springframework.test.context

Examples of org.springframework.test.context.TestContextManager.prepareTestInstance()


    @Before
    public void setUpContext() throws Exception {
        //this is where the magic happens, we actually do "by hand" what the spring runner would do for us,
        // read the JavaDoc for the class bellow to know exactly what it does, the method names are quite accurate though
        TestContextManager testContextManager = new TestContextManager(getClass());
        testContextManager.prepareTestInstance(this);
    }
}
View Full Code Here


                    applicationContext.getBean(MessageListeners.class).addMessageListener(webSocketTestEventListener);
                }
            };

            try {
                testContextManager.prepareTestInstance(null);
            } catch (Exception e) {
                log.error("Failed to load application context", e);
            }
        }
       
View Full Code Here

                getTestContext().markApplicationContextDirty(DirtiesContext.HierarchyMode.CURRENT_LEVEL);
            }
        };
       
        try {
            testContextManager.prepareTestInstance(null);
        } catch (Exception e) {
            log.error("Failed to stop application context", e);
        }
       
        applicationContext = null;
View Full Code Here

    @Override
    public Statement apply(Statement base, FrameworkMethod method, Object target) {
        TestContextManager contextManager = getTestContextManager(method.getMethod().getDeclaringClass());
        try {
            contextManager.prepareTestInstance(target);
        } catch (Exception e) {
            throw new IllegalStateException("Could not instantiate test instance", e);
        }
        Statement statement = super.apply(base, method, target);
        statement = withBefores(method, target, statement, contextManager);
View Full Code Here

     */
    public void injectDependenciesInto(Object target) {
        if (springIsOnClasspath() && annotatedWithSpringContext(target)) {
            TestContextManager contextManager = getTestContextManager(target.getClass());
            try {
                contextManager.prepareTestInstance(target);
            } catch (Exception e) {
                throw new IllegalStateException("Could not instantiate test instance", e);
            }
        }
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.