Java Code Examples for org.springframework.test.context.junit4.statements.ProfileValueChecker

Following code examples demonstrate how to use org.springframework.test.context.junit4.statements.ProfileValueCheckerfrom spring-framework. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.springframework.test.context.junit4.statements.ProfileValueCheckerand various code implementation of this class.

    public Statement apply(
            final Statement base,
            final FrameworkMethod frameworkMethod,
            final Object testInstance) {
        LOGGER.debug("Applying SpringMethodRule to test method [{}]", frameworkMethod.getMethod());
        final Class<?> testClass = testInstance.getClass();
        final TestContextManager testContextManager = SpringClassRule.getTestContextManager(testClass);

        Statement statement = base;
        statement = new RunBeforeTestMethodCallbacks(statement, testInstance, frameworkMethod.getMethod(),
        statement = new RunAfterTestMethodCallbacks(statement, testInstance, frameworkMethod.getMethod(),
        statement = new RunPrepareTestInstanceCallbacks(statement, testInstance, testContextManager);
        statement = new SpringRepeat(statement, frameworkMethod.getMethod());
        statement = new SpringFailOnTimeout(statement, frameworkMethod.getMethod());
        statement = new ProfileValueChecker(statement, testInstance.getClass(), frameworkMethod.getMethod());
        return statement;

    public Statement apply(final Statement base, final Description description) {
        final Class<?> testClass = description.getTestClass();
        LOGGER.debug("Applying SpringClassRule to test class [{}]", testClass.getName());

        final TestContextManager testContextManager = getTestContextManager(testClass);
        Statement statement = base;
        statement = new RunBeforeTestClassCallbacks(statement, testContextManager);
        statement = new RunAfterTestClassCallbacks(statement, testContextManager);
        statement = new ProfileValueChecker(statement, testClass, null);
        statement = new TestContextManagerCacheEvictor(statement, testClass);
        return statement;

ProfileValueChecker is a custom JUnit Statement that checks whether a test class or test method is e

nabled in the current environment via Spring's IfProfileValue @IfProfileValue annotation. @author Sam Brannen @author Philippe Marschall @since 4.2 @see #evaluate() @see IfProfileValue @see ProfileValueUtils

Read More