当前位置: 首页>>代码示例>>Java>>正文


Java ProfileValueUtils类代码示例

本文整理汇总了Java中org.springframework.test.annotation.ProfileValueUtils的典型用法代码示例。如果您正苦于以下问题:Java ProfileValueUtils类的具体用法?Java ProfileValueUtils怎么用?Java ProfileValueUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ProfileValueUtils类属于org.springframework.test.annotation包,在下文中一共展示了ProfileValueUtils类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: evaluate

import org.springframework.test.annotation.ProfileValueUtils; //导入依赖的package包/类
/**
 * Determine if the test specified by arguments to the
 * {@linkplain #ProfileValueChecker constructor} is <em>enabled</em> in
 * the current environment, as configured via the {@link IfProfileValue
 * &#064;IfProfileValue} annotation.
 * <p>If the test is not annotated with {@code @IfProfileValue} it is
 * considered enabled.
 * <p>If a test is not enabled, this method will abort further evaluation
 * of the execution chain with a failed assumption; otherwise, this method
 * will simply evaluate the next {@link Statement} in the execution chain.
 * @see ProfileValueUtils#isTestEnabledInThisEnvironment(Class)
 * @see ProfileValueUtils#isTestEnabledInThisEnvironment(Method, Class)
 * @see org.junit.Assume
 */
@Override
public void evaluate() throws Throwable {
	if (this.testMethod == null) {
		if (!ProfileValueUtils.isTestEnabledInThisEnvironment(this.testClass)) {
			// Invoke assumeTrue() with false to avoid direct reference to JUnit's
			// AssumptionViolatedException which exists in two packages as of JUnit 4.12.
			Annotation ann = AnnotationUtils.findAnnotation(this.testClass, IfProfileValue.class);
			Assume.assumeTrue(String.format(
					"Profile configured via [%s] is not enabled in this environment for test class [%s].",
					ann, this.testClass.getName()), false);
		}
	}
	else {
		if (!ProfileValueUtils.isTestEnabledInThisEnvironment(this.testMethod, this.testClass)) {
			// Invoke assumeTrue() with false to avoid direct reference to JUnit's
			// AssumptionViolatedException which exists in two packages as of JUnit 4.12.
			Assume.assumeTrue(String.format(
					"Profile configured via @IfProfileValue is not enabled in this environment for test method [%s].",
					this.testMethod), false);
		}
	}

	this.next.evaluate();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:39,代码来源:ProfileValueChecker.java

示例2: getDescription

import org.springframework.test.annotation.ProfileValueUtils; //导入依赖的package包/类
/**
 * Return a description suitable for an ignored test class if the test is
 * disabled via {@code @IfProfileValue} at the class-level, and
 * otherwise delegate to the parent implementation.
 * @see ProfileValueUtils#isTestEnabledInThisEnvironment(Class)
 */
@Override
public Description getDescription() {
	if (!ProfileValueUtils.isTestEnabledInThisEnvironment(getTestClass().getJavaClass())) {
		return Description.createSuiteDescription(getTestClass().getJavaClass());
	}
	return super.getDescription();
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:14,代码来源:SpringJUnit4ClassRunner.java

示例3: getDescription

import org.springframework.test.annotation.ProfileValueUtils; //导入依赖的package包/类
/**
 * Returns a description suitable for an ignored test class if the test is disabled via {@code @IfProfileValue} at
 * the class-level, and otherwise delegates to the parent implementation.
 *
 * @see ProfileValueUtils#isTestEnabledInThisEnvironment(Class)
 */
@Override
public Description getDescription() {
    if (!ProfileValueUtils.isTestEnabledInThisEnvironment(getTestClass().getJavaClass())) {
        return Description.createSuiteDescription(getTestClass().getJavaClass());
    }
    return super.getDescription();
}
 
开发者ID:chiknrice,项目名称:concordion-spring-runner,代码行数:14,代码来源:SpringifiedConcordionRunner.java

示例4: getDescription

import org.springframework.test.annotation.ProfileValueUtils; //导入依赖的package包/类
/**
 * Returns a description suitable for an ignored test class if the test is
 * disabled via {@code &#064;IfProfileValue} at the class-level, and
 * otherwise delegates to the parent implementation.
 * @see ProfileValueUtils#isTestEnabledInThisEnvironment(Class)
 */
@Override
public Description getDescription() {
	if (!ProfileValueUtils.isTestEnabledInThisEnvironment(getTestClass().getJavaClass())) {
		return Description.createSuiteDescription(getTestClass().getJavaClass());
	}
	return super.getDescription();
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:14,代码来源:SpringJUnit4ClassRunner.java

示例5: AbstractJUnit38SpringContextTests

import org.springframework.test.annotation.ProfileValueUtils; //导入依赖的package包/类
/**
 * Constructs a new AbstractJUnit38SpringContextTests instance; initializes
 * the internal {@link TestContextManager} for the current test; and
 * retrieves the configured (or default) {@link ProfileValueSource}.
 */
public AbstractJUnit38SpringContextTests() {
	super();
	this.testContextManager = new TestContextManager(getClass());
	this.profileValueSource = ProfileValueUtils.retrieveProfileValueSource(getClass());
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:11,代码来源:AbstractJUnit38SpringContextTests.java

示例6: runBare

import org.springframework.test.annotation.ProfileValueUtils; //导入依赖的package包/类
/**
 * Runs the <em>Spring TestContext Framework</em> test sequence.
 * <p>
 * In addition to standard {@link TestCase#runBare()} semantics, this
 * implementation performs the following:
 * <ul>
 * <li>Calls {@link TestContextManager#prepareTestInstance(Object)
 * prepareTestInstance()},
 * {@link TestContextManager#beforeTestMethod(Object,Method)
 * beforeTestMethod()}, and
 * {@link TestContextManager#afterTestMethod(Object,Method,Throwable)
 * afterTestMethod()} on this test's {@link TestContextManager} at the
 * appropriate test execution points.</li>
 * <li>Provides support for {@link IfProfileValue &#064;IfProfileValue}.</li>
 * <li>Provides support for {@link Repeat &#064;Repeat}.</li>
 * <li>Provides support for {@link Timed &#064;Timed}.</li>
 * <li>Provides support for {@link ExpectedException
 * &#064;ExpectedException}.</li>
 * </ul>
 *
 * @see ProfileValueUtils#isTestEnabledInThisEnvironment
 */
@Override
public void runBare() throws Throwable {
	this.testContextManager.prepareTestInstance(this);
	final Method testMethod = getTestMethod();

	if (!ProfileValueUtils.isTestEnabledInThisEnvironment(this.profileValueSource, testMethod, getClass())) {
		recordDisabled(testMethod);
		return;
	}

	runTestTimed(new TestExecutionCallback() {

		public void run() throws Throwable {
			runManaged(testMethod);
		}
	}, testMethod);
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:40,代码来源:AbstractJUnit38SpringContextTests.java

示例7: run

import org.springframework.test.annotation.ProfileValueUtils; //导入依赖的package包/类
/**
 * Check whether the test is enabled in the current execution environment.
 * <p>This prevents classes with a non-matching {@code @IfProfileValue}
 * annotation from running altogether, even skipping the execution of
 * {@code prepareTestInstance()} methods in {@code TestExecutionListeners}.
 * @see ProfileValueUtils#isTestEnabledInThisEnvironment(Class)
 * @see org.springframework.test.annotation.IfProfileValue
 * @see org.springframework.test.context.TestExecutionListener
 */
@Override
public void run(RunNotifier notifier) {
	if (!ProfileValueUtils.isTestEnabledInThisEnvironment(getTestClass().getJavaClass())) {
		notifier.fireTestIgnored(getDescription());
		return;
	}
	super.run(notifier);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:18,代码来源:SpringJUnit4ClassRunner.java

示例8: run

import org.springframework.test.annotation.ProfileValueUtils; //导入依赖的package包/类
/**
 * Check whether the test is enabled in the first place. This prevents classes with a non-matching {@code
 *
 * @IfProfileValue} annotation from running altogether, even skipping the execution of {@code prepareTestInstance()}
 * {@code TestExecutionListener} methods.
 * @see ProfileValueUtils#isTestEnabledInThisEnvironment(Class)
 * @see org.springframework.test.annotation.IfProfileValue
 * @see org.springframework.test.context.TestExecutionListener
 */
@Override
public void run(RunNotifier notifier) {
    if (!ProfileValueUtils.isTestEnabledInThisEnvironment(getTestClass().getJavaClass())) {
        notifier.fireTestIgnored(getDescription());
        return;
    }
    super.run(notifier);
}
 
开发者ID:chiknrice,项目名称:concordion-spring-runner,代码行数:18,代码来源:SpringifiedConcordionRunner.java

示例9: run

import org.springframework.test.annotation.ProfileValueUtils; //导入依赖的package包/类
/**
 * Check whether the test is enabled in the first place. This prevents
 * classes with a non-matching {@code &#064;IfProfileValue} annotation
 * from running altogether, even skipping the execution of
 * {@code prepareTestInstance()} {@code TestExecutionListener}
 * methods.
 * @see ProfileValueUtils#isTestEnabledInThisEnvironment(Class)
 * @see org.springframework.test.annotation.IfProfileValue
 * @see org.springframework.test.context.TestExecutionListener
 */
@Override
public void run(RunNotifier notifier) {
	if (!ProfileValueUtils.isTestEnabledInThisEnvironment(getTestClass().getJavaClass())) {
		notifier.fireTestIgnored(getDescription());
		return;
	}
	super.run(notifier);
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:19,代码来源:SpringJUnit4ClassRunner.java

示例10: isTestMethodIgnored

import org.springframework.test.annotation.ProfileValueUtils; //导入依赖的package包/类
/**
 * Return {@code true} if {@link Ignore @Ignore} is present for the supplied
 * {@linkplain FrameworkMethod test method} or if the test method is disabled
 * via {@code @IfProfileValue}.
 * @see ProfileValueUtils#isTestEnabledInThisEnvironment(Method, Class)
 */
protected boolean isTestMethodIgnored(FrameworkMethod frameworkMethod) {
	Method method = frameworkMethod.getMethod();
	return (method.isAnnotationPresent(Ignore.class) ||
			!ProfileValueUtils.isTestEnabledInThisEnvironment(method, getTestClass().getJavaClass()));
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:12,代码来源:SpringJUnit4ClassRunner.java

示例11: isTestMethodIgnored

import org.springframework.test.annotation.ProfileValueUtils; //导入依赖的package包/类
/**
 * Returns {@code true} if {@link Ignore &#064;Ignore} is present for
 * the supplied {@link FrameworkMethod test method} or if the test method is
 * disabled via {@code &#064;IfProfileValue}.
 * @see ProfileValueUtils#isTestEnabledInThisEnvironment(Method, Class)
 */
protected boolean isTestMethodIgnored(FrameworkMethod frameworkMethod) {
	Method method = frameworkMethod.getMethod();
	return (method.isAnnotationPresent(Ignore.class) || !ProfileValueUtils.isTestEnabledInThisEnvironment(method,
		getTestClass().getJavaClass()));
}
 
开发者ID:deathspeeder,项目名称:class-guard,代码行数:12,代码来源:SpringJUnit4ClassRunner.java


注:本文中的org.springframework.test.annotation.ProfileValueUtils类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。