[SPR-5914] ProfileValueUtils now properly ensures that class-level usage of @IfProfileValue overrides method-level usage.
This commit is contained in:
@@ -0,0 +1,217 @@
|
||||
/*
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.test.annotation;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.junit.runners.JUnit4;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link ProfileValueUtils}.
|
||||
*
|
||||
* @author Sam Brannen
|
||||
* @since 3.0
|
||||
*/
|
||||
@RunWith(JUnit4.class)
|
||||
public class ProfileValueUtilsTests {
|
||||
|
||||
private static final String NON_ANNOTATED_METHOD = "nonAnnotatedMethod";
|
||||
private static final String ENABLED_ANNOTATED_METHOD = "enabledAnnotatedMethod";
|
||||
private static final String DISABLED_ANNOTATED_METHOD = "disabledAnnotatedMethod";
|
||||
|
||||
private static final String NAME = "ProfileValueUtilsTests.profile_value.name";
|
||||
private static final String VALUE = "enigma";
|
||||
|
||||
|
||||
@BeforeClass
|
||||
public static void setProfileValue() {
|
||||
System.setProperty(NAME, VALUE);
|
||||
}
|
||||
|
||||
private void assertClassIsEnabled(Class<?> testClass) throws Exception {
|
||||
assertTrue("Test class [" + testClass + "] should be enabled.",
|
||||
ProfileValueUtils.isTestEnabledInThisEnvironment(testClass));
|
||||
}
|
||||
|
||||
private void assertClassIsDisabled(Class<?> testClass) throws Exception {
|
||||
assertFalse("Test class [" + testClass + "] should be disbled.",
|
||||
ProfileValueUtils.isTestEnabledInThisEnvironment(testClass));
|
||||
}
|
||||
|
||||
private void assertMethodIsEnabled(String methodName, Class<?> testClass) throws Exception {
|
||||
Method testMethod = testClass.getMethod(methodName);
|
||||
assertTrue("Test method [" + testMethod + "] should be enabled.",
|
||||
ProfileValueUtils.isTestEnabledInThisEnvironment(testMethod, testClass));
|
||||
}
|
||||
|
||||
private void assertMethodIsDisabled(String methodName, Class<?> testClass) throws Exception {
|
||||
Method testMethod = testClass.getMethod(methodName);
|
||||
assertFalse("Test method [" + testMethod + "] should be disabled.",
|
||||
ProfileValueUtils.isTestEnabledInThisEnvironment(testMethod, testClass));
|
||||
}
|
||||
|
||||
private void assertMethodIsEnabled(ProfileValueSource profileValueSource, String methodName, Class<?> testClass)
|
||||
throws Exception {
|
||||
Method testMethod = testClass.getMethod(methodName);
|
||||
assertTrue("Test method [" + testMethod + "] should be enabled for ProfileValueSource [" + profileValueSource
|
||||
+ "].", ProfileValueUtils.isTestEnabledInThisEnvironment(profileValueSource, testMethod, testClass));
|
||||
}
|
||||
|
||||
private void assertMethodIsDisabled(ProfileValueSource profileValueSource, String methodName, Class<?> testClass)
|
||||
throws Exception {
|
||||
Method testMethod = testClass.getMethod(methodName);
|
||||
assertFalse("Test method [" + testMethod + "] should be disabled for ProfileValueSource [" + profileValueSource
|
||||
+ "].", ProfileValueUtils.isTestEnabledInThisEnvironment(profileValueSource, testMethod, testClass));
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
@Test
|
||||
public void isTestEnabledInThisEnvironmentForProvidedClass() throws Exception {
|
||||
assertClassIsEnabled(NonAnnotated.class);
|
||||
assertClassIsEnabled(EnabledAnnotatedSingleValue.class);
|
||||
assertClassIsEnabled(EnabledAnnotatedMultiValue.class);
|
||||
assertClassIsDisabled(DisabledAnnotatedSingleValue.class);
|
||||
assertClassIsDisabled(DisabledAnnotatedMultiValue.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isTestEnabledInThisEnvironmentForProvidedMethodAndClass() throws Exception {
|
||||
assertMethodIsEnabled(NON_ANNOTATED_METHOD, NonAnnotated.class);
|
||||
|
||||
assertMethodIsEnabled(NON_ANNOTATED_METHOD, EnabledAnnotatedSingleValue.class);
|
||||
assertMethodIsEnabled(ENABLED_ANNOTATED_METHOD, EnabledAnnotatedSingleValue.class);
|
||||
assertMethodIsDisabled(DISABLED_ANNOTATED_METHOD, EnabledAnnotatedSingleValue.class);
|
||||
|
||||
assertMethodIsEnabled(NON_ANNOTATED_METHOD, EnabledAnnotatedMultiValue.class);
|
||||
assertMethodIsEnabled(ENABLED_ANNOTATED_METHOD, EnabledAnnotatedMultiValue.class);
|
||||
assertMethodIsDisabled(DISABLED_ANNOTATED_METHOD, EnabledAnnotatedMultiValue.class);
|
||||
|
||||
assertMethodIsDisabled(NON_ANNOTATED_METHOD, DisabledAnnotatedSingleValue.class);
|
||||
assertMethodIsDisabled(ENABLED_ANNOTATED_METHOD, DisabledAnnotatedSingleValue.class);
|
||||
assertMethodIsDisabled(DISABLED_ANNOTATED_METHOD, DisabledAnnotatedSingleValue.class);
|
||||
|
||||
assertMethodIsDisabled(NON_ANNOTATED_METHOD, DisabledAnnotatedMultiValue.class);
|
||||
assertMethodIsDisabled(ENABLED_ANNOTATED_METHOD, DisabledAnnotatedMultiValue.class);
|
||||
assertMethodIsDisabled(DISABLED_ANNOTATED_METHOD, DisabledAnnotatedMultiValue.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void isTestEnabledInThisEnvironmentForProvidedProfileValueSourceMethodAndClass() throws Exception {
|
||||
|
||||
ProfileValueSource profileValueSource = SystemProfileValueSource.getInstance();
|
||||
|
||||
assertMethodIsEnabled(profileValueSource, NON_ANNOTATED_METHOD, NonAnnotated.class);
|
||||
|
||||
assertMethodIsEnabled(profileValueSource, NON_ANNOTATED_METHOD, EnabledAnnotatedSingleValue.class);
|
||||
assertMethodIsEnabled(profileValueSource, ENABLED_ANNOTATED_METHOD, EnabledAnnotatedSingleValue.class);
|
||||
assertMethodIsDisabled(profileValueSource, DISABLED_ANNOTATED_METHOD, EnabledAnnotatedSingleValue.class);
|
||||
|
||||
assertMethodIsEnabled(profileValueSource, NON_ANNOTATED_METHOD, EnabledAnnotatedMultiValue.class);
|
||||
assertMethodIsEnabled(profileValueSource, ENABLED_ANNOTATED_METHOD, EnabledAnnotatedMultiValue.class);
|
||||
assertMethodIsDisabled(profileValueSource, DISABLED_ANNOTATED_METHOD, EnabledAnnotatedMultiValue.class);
|
||||
|
||||
assertMethodIsDisabled(profileValueSource, NON_ANNOTATED_METHOD, DisabledAnnotatedSingleValue.class);
|
||||
assertMethodIsDisabled(profileValueSource, ENABLED_ANNOTATED_METHOD, DisabledAnnotatedSingleValue.class);
|
||||
assertMethodIsDisabled(profileValueSource, DISABLED_ANNOTATED_METHOD, DisabledAnnotatedSingleValue.class);
|
||||
|
||||
assertMethodIsDisabled(profileValueSource, NON_ANNOTATED_METHOD, DisabledAnnotatedMultiValue.class);
|
||||
assertMethodIsDisabled(profileValueSource, ENABLED_ANNOTATED_METHOD, DisabledAnnotatedMultiValue.class);
|
||||
assertMethodIsDisabled(profileValueSource, DISABLED_ANNOTATED_METHOD, DisabledAnnotatedMultiValue.class);
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private static class NonAnnotated {
|
||||
|
||||
public void nonAnnotatedMethod() {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@IfProfileValue(name = NAME, value = VALUE)
|
||||
private static class EnabledAnnotatedSingleValue {
|
||||
|
||||
public void nonAnnotatedMethod() {
|
||||
}
|
||||
|
||||
@IfProfileValue(name = NAME, value = VALUE)
|
||||
public void enabledAnnotatedMethod() {
|
||||
}
|
||||
|
||||
@IfProfileValue(name = NAME, value = VALUE + "X")
|
||||
public void disabledAnnotatedMethod() {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@IfProfileValue(name = NAME, values = { "foo", VALUE, "bar" })
|
||||
private static class EnabledAnnotatedMultiValue {
|
||||
|
||||
public void nonAnnotatedMethod() {
|
||||
}
|
||||
|
||||
@IfProfileValue(name = NAME, value = VALUE)
|
||||
public void enabledAnnotatedMethod() {
|
||||
}
|
||||
|
||||
@IfProfileValue(name = NAME, value = VALUE + "X")
|
||||
public void disabledAnnotatedMethod() {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@IfProfileValue(name = NAME, value = VALUE + "X")
|
||||
private static class DisabledAnnotatedSingleValue {
|
||||
|
||||
public void nonAnnotatedMethod() {
|
||||
}
|
||||
|
||||
@IfProfileValue(name = NAME, value = VALUE)
|
||||
public void enabledAnnotatedMethod() {
|
||||
}
|
||||
|
||||
@IfProfileValue(name = NAME, value = VALUE + "X")
|
||||
public void disabledAnnotatedMethod() {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
@IfProfileValue(name = NAME, values = { "foo", "bar" })
|
||||
private static class DisabledAnnotatedMultiValue {
|
||||
|
||||
public void nonAnnotatedMethod() {
|
||||
}
|
||||
|
||||
@IfProfileValue(name = NAME, value = VALUE)
|
||||
public void enabledAnnotatedMethod() {
|
||||
}
|
||||
|
||||
@IfProfileValue(name = NAME, value = VALUE + "X")
|
||||
public void disabledAnnotatedMethod() {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,6 +16,9 @@
|
||||
|
||||
package org.springframework.test.context.junit38;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestResult;
|
||||
|
||||
@@ -26,61 +29,108 @@ import org.springframework.test.annotation.SystemProfileValueSource;
|
||||
import org.springframework.test.context.TestExecutionListeners;
|
||||
|
||||
/**
|
||||
* Verifies proper handling of {@link IfProfileValue @IfProfileValue} and
|
||||
* {@link ProfileValueSourceConfiguration @ProfileValueSourceConfiguration} in
|
||||
* conjunction with {@link AbstractJUnit38SpringContextTests}.
|
||||
*
|
||||
* Verifies proper handling of {@link IfProfileValue @IfProfileValue} and
|
||||
* {@link ProfileValueSourceConfiguration @ProfileValueSourceConfiguration}
|
||||
* in conjunction with {@link AbstractJUnit38SpringContextTests}.
|
||||
*
|
||||
* @author Sam Brannen
|
||||
* @since 2.5
|
||||
*/
|
||||
public class ProfileValueJUnit38SpringContextTests extends TestCase {
|
||||
|
||||
private static final String NAME = "ProfileValueAnnotationAwareTransactionalTests.profile_value.name";
|
||||
private static final String EMPTY = "testIfProfileValueEmpty";
|
||||
private static final String DISABLED_VIA_WRONG_NAME = "testIfProfileValueDisabledViaWrongName";
|
||||
private static final String DISABLED_VIA_WRONG_VALUE = "testIfProfileValueDisabledViaWrongValue";
|
||||
private static final String ENABLED_VIA_MULTIPLE_VALUES = "testIfProfileValueEnabledViaMultipleValues";
|
||||
private static final String ENABLED_VIA_SINGLE_VALUE = "testIfProfileValueEnabledViaSingleValue";
|
||||
private static final String NOT_CONFIGURED = "testIfProfileValueNotConfigured";
|
||||
|
||||
private static final String NAME = "ProfileValueAnnotationAwareTransactionalTests.profile_value.name";
|
||||
private static final String VALUE = "enigma";
|
||||
|
||||
private final Map<String, Integer> expectedInvocationCounts = new HashMap<String, Integer>();
|
||||
|
||||
|
||||
public ProfileValueJUnit38SpringContextTests() {
|
||||
System.setProperty(NAME, VALUE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
this.expectedInvocationCounts.put(EMPTY, 0);
|
||||
this.expectedInvocationCounts.put(DISABLED_VIA_WRONG_NAME, 0);
|
||||
this.expectedInvocationCounts.put(DISABLED_VIA_WRONG_VALUE, 0);
|
||||
this.expectedInvocationCounts.put(ENABLED_VIA_SINGLE_VALUE, 1);
|
||||
this.expectedInvocationCounts.put(ENABLED_VIA_MULTIPLE_VALUES, 1);
|
||||
this.expectedInvocationCounts.put(NOT_CONFIGURED, 1);
|
||||
}
|
||||
|
||||
private void configureDisabledClassExpectations() {
|
||||
this.expectedInvocationCounts.put(ENABLED_VIA_SINGLE_VALUE, 0);
|
||||
this.expectedInvocationCounts.put(ENABLED_VIA_MULTIPLE_VALUES, 0);
|
||||
this.expectedInvocationCounts.put(NOT_CONFIGURED, 0);
|
||||
}
|
||||
|
||||
private void runTestAndAssertCounters(Class<? extends DefaultProfileValueSourceTestCase> testCaseType,
|
||||
String testName, int expectedInvocationCount, int expectedErrorCount,
|
||||
int expectedFailureCount) throws Exception {
|
||||
String testName, int expectedInvocationCount, int expectedErrorCount, int expectedFailureCount)
|
||||
throws Exception {
|
||||
|
||||
DefaultProfileValueSourceTestCase testCase = testCaseType.newInstance();
|
||||
testCase.setName(testName);
|
||||
TestResult testResult = testCase.run();
|
||||
assertEquals("Verifying number of invocations for test method [" + testName + "].", expectedInvocationCount,
|
||||
testCase.invocationCount);
|
||||
testCase.invocationCount);
|
||||
assertEquals("Verifying number of errors for test method [" + testName + "].", expectedErrorCount,
|
||||
testResult.errorCount());
|
||||
testResult.errorCount());
|
||||
assertEquals("Verifying number of failures for test method [" + testName + "].", expectedFailureCount,
|
||||
testResult.failureCount());
|
||||
testResult.failureCount());
|
||||
}
|
||||
|
||||
private void runTests(final Class<? extends DefaultProfileValueSourceTestCase> testCaseType) throws Exception {
|
||||
runTestAndAssertCounters(testCaseType, "testIfProfileValueEmpty", 0, 0, 0);
|
||||
runTestAndAssertCounters(testCaseType, "testIfProfileValueDisabledViaWrongName", 0, 0, 0);
|
||||
runTestAndAssertCounters(testCaseType, "testIfProfileValueDisabledViaWrongValue", 0, 0, 0);
|
||||
runTestAndAssertCounters(testCaseType, "testIfProfileValueEnabledViaSingleValue", 1, 0, 0);
|
||||
runTestAndAssertCounters(testCaseType, "testIfProfileValueEnabledViaMultipleValues", 1, 0, 0);
|
||||
runTestAndAssertCounters(testCaseType, "testIfProfileValueNotConfigured", 1, 0, 0);
|
||||
runTestAndAssertCounters(testCaseType, EMPTY, expectedInvocationCounts.get(EMPTY), 0, 0);
|
||||
runTestAndAssertCounters(testCaseType, DISABLED_VIA_WRONG_NAME,
|
||||
expectedInvocationCounts.get(DISABLED_VIA_WRONG_NAME), 0, 0);
|
||||
runTestAndAssertCounters(testCaseType, DISABLED_VIA_WRONG_VALUE,
|
||||
expectedInvocationCounts.get(DISABLED_VIA_WRONG_VALUE), 0, 0);
|
||||
runTestAndAssertCounters(testCaseType, ENABLED_VIA_SINGLE_VALUE,
|
||||
expectedInvocationCounts.get(ENABLED_VIA_SINGLE_VALUE), 0, 0);
|
||||
runTestAndAssertCounters(testCaseType, ENABLED_VIA_MULTIPLE_VALUES,
|
||||
expectedInvocationCounts.get(ENABLED_VIA_MULTIPLE_VALUES), 0, 0);
|
||||
runTestAndAssertCounters(testCaseType, NOT_CONFIGURED, expectedInvocationCounts.get(NOT_CONFIGURED), 0, 0);
|
||||
}
|
||||
|
||||
public void testDefaultProfileValueSource() throws Exception {
|
||||
assertEquals("Verifying the type of the configured ProfileValueSource.", SystemProfileValueSource.class,
|
||||
new DefaultProfileValueSourceTestCase().getProfileValueSource().getClass());
|
||||
new DefaultProfileValueSourceTestCase().getProfileValueSource().getClass());
|
||||
runTests(DefaultProfileValueSourceTestCase.class);
|
||||
}
|
||||
|
||||
public void testHardCodedProfileValueSource() throws Exception {
|
||||
assertEquals("Verifying the type of the configured ProfileValueSource.", HardCodedProfileValueSource.class,
|
||||
new HardCodedProfileValueSourceTestCase().getProfileValueSource().getClass());
|
||||
new HardCodedProfileValueSourceTestCase().getProfileValueSource().getClass());
|
||||
runTests(HardCodedProfileValueSourceTestCase.class);
|
||||
}
|
||||
|
||||
public void testClassLevelIfProfileValueEnabledSingleValue() throws Exception {
|
||||
runTests(ClassLevelIfProfileValueEnabledSingleValueTestCase.class);
|
||||
}
|
||||
|
||||
public void testClassLevelIfProfileValueDisabledSingleValue() throws Exception {
|
||||
configureDisabledClassExpectations();
|
||||
runTests(ClassLevelIfProfileValueDisabledSingleValueTestCase.class);
|
||||
}
|
||||
|
||||
public void testClassLevelIfProfileValueEnabledMultiValue() throws Exception {
|
||||
runTests(ClassLevelIfProfileValueEnabledMultiValueTestCase.class);
|
||||
}
|
||||
|
||||
public void testClassLevelIfProfileValueDisabledMultiValue() throws Exception {
|
||||
configureDisabledClassExpectations();
|
||||
runTests(ClassLevelIfProfileValueDisabledMultiValueTestCase.class);
|
||||
}
|
||||
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Note that {@link TestExecutionListeners @TestExecutionListeners} is
|
||||
@@ -92,6 +142,7 @@ public class ProfileValueJUnit38SpringContextTests extends TestCase {
|
||||
|
||||
int invocationCount = 0;
|
||||
|
||||
|
||||
public ProfileValueSource getProfileValueSource() {
|
||||
return super.profileValueSource;
|
||||
}
|
||||
@@ -129,13 +180,10 @@ public class ProfileValueJUnit38SpringContextTests extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ProfileValueSourceConfiguration(HardCodedProfileValueSource.class)
|
||||
public static class HardCodedProfileValueSourceTestCase extends DefaultProfileValueSourceTestCase {
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static class HardCodedProfileValueSource implements ProfileValueSource {
|
||||
|
||||
public String get(final String key) {
|
||||
@@ -143,4 +191,20 @@ public class ProfileValueJUnit38SpringContextTests extends TestCase {
|
||||
}
|
||||
}
|
||||
|
||||
@IfProfileValue(name = NAME, value = VALUE)
|
||||
public static class ClassLevelIfProfileValueEnabledSingleValueTestCase extends DefaultProfileValueSourceTestCase {
|
||||
}
|
||||
|
||||
@IfProfileValue(name = NAME, value = VALUE + "X")
|
||||
public static class ClassLevelIfProfileValueDisabledSingleValueTestCase extends DefaultProfileValueSourceTestCase {
|
||||
}
|
||||
|
||||
@IfProfileValue(name = NAME, values = { "foo", VALUE, "bar" })
|
||||
public static class ClassLevelIfProfileValueEnabledMultiValueTestCase extends DefaultProfileValueSourceTestCase {
|
||||
}
|
||||
|
||||
@IfProfileValue(name = NAME, values = { "foo", "bar", "baz" })
|
||||
public static class ClassLevelIfProfileValueDisabledMultiValueTestCase extends DefaultProfileValueSourceTestCase {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2008 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,37 +16,36 @@
|
||||
|
||||
package org.springframework.test.context.junit4;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.test.annotation.IfProfileValue;
|
||||
import org.springframework.test.annotation.ProfileValueSource;
|
||||
import org.springframework.test.annotation.ProfileValueSourceConfiguration;
|
||||
import org.springframework.test.context.TestExecutionListeners;
|
||||
|
||||
/**
|
||||
* Verifies proper handling of JUnit's {@link org.junit.Ignore @Ignore} and
|
||||
* Spring's
|
||||
* {@link org.springframework.test.annotation.IfProfileValue @IfProfileValue}
|
||||
* and {@link ProfileValueSourceConfiguration @ProfileValueSourceConfiguration}
|
||||
* (with the <em>implicit, default {@link ProfileValueSource}</em>)
|
||||
* annotations in conjunction with the {@link SpringJUnit4ClassRunner}.
|
||||
*
|
||||
* <p>Note that {@link TestExecutionListeners @TestExecutionListeners} is
|
||||
* Verifies proper handling of JUnit's {@link Ignore @Ignore} and Spring's
|
||||
* {@link IfProfileValue @IfProfileValue} and
|
||||
* {@link ProfileValueSourceConfiguration @ProfileValueSourceConfiguration}
|
||||
* (with the <em>implicit, default {@link ProfileValueSource}</em>) annotations in
|
||||
* conjunction with the {@link SpringJUnit4ClassRunner}.
|
||||
* <p>
|
||||
* Note that {@link TestExecutionListeners @TestExecutionListeners} is
|
||||
* explicitly configured with an empty list, thus disabling all default
|
||||
* listeners.
|
||||
*
|
||||
*
|
||||
* @author Sam Brannen
|
||||
* @since 2.5
|
||||
* @see HardCodedProfileValueSourceSpringRunnerTests
|
||||
*/
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@TestExecutionListeners({})
|
||||
@TestExecutionListeners( {})
|
||||
public class EnabledAndIgnoredSpringRunnerTests {
|
||||
|
||||
protected static final String NAME = "EnabledAndIgnoredSpringRunnerTests.profile_value.name";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007 the original author or authors.
|
||||
* Copyright 2002-2009 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -17,20 +17,19 @@
|
||||
package org.springframework.test.context.junit4;
|
||||
|
||||
import org.junit.BeforeClass;
|
||||
|
||||
import org.springframework.test.annotation.ProfileValueSource;
|
||||
import org.springframework.test.annotation.ProfileValueSourceConfiguration;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Verifies proper handling of JUnit's {@link org.junit.Ignore @Ignore} and
|
||||
* Spring's
|
||||
* {@link org.springframework.test.annotation.IfProfileValue @IfProfileValue}
|
||||
* and {@link ProfileValueSourceConfiguration @ProfileValueSourceConfiguration}
|
||||
* (with an <em>explicit, custom defined {@link ProfileValueSource}</em>)
|
||||
* annotations in conjunction with the {@link SpringJUnit4ClassRunner}.
|
||||
* Verifies proper handling of JUnit's {@link org.junit.Ignore @Ignore} and
|
||||
* Spring's {@link org.springframework.test.annotation.IfProfileValue
|
||||
* @IfProfileValue} and {@link ProfileValueSourceConfiguration
|
||||
* @ProfileValueSourceConfiguration} (with an
|
||||
* <em>explicit, custom defined {@link ProfileValueSource}</em>) annotations in
|
||||
* conjunction with the {@link SpringJUnit4ClassRunner}.
|
||||
* </p>
|
||||
*
|
||||
*
|
||||
* @author Sam Brannen
|
||||
* @since 2.5
|
||||
* @see EnabledAndIgnoredSpringRunnerTests
|
||||
|
||||
Reference in New Issue
Block a user