本文整理汇总了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
* @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();
}
示例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();
}
示例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();
}
示例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 @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();
}
示例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());
}
示例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 @IfProfileValue}.</li>
* <li>Provides support for {@link Repeat @Repeat}.</li>
* <li>Provides support for {@link Timed @Timed}.</li>
* <li>Provides support for {@link ExpectedException
* @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);
}
示例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);
}
示例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);
}
示例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 @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);
}
示例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()));
}
示例11: isTestMethodIgnored
import org.springframework.test.annotation.ProfileValueUtils; //导入依赖的package包/类
/**
* Returns {@code true} if {@link Ignore @Ignore} is present for
* the supplied {@link 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()));
}