|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |
@Target(value={TYPE,METHOD}) @Retention(value=RUNTIME) @Inherited @Documented public @interface IfProfileValue
Test annotation to indicate that a test is enabled for a specific testing
profile or environment. If the configured ProfileValueSource
returns
a matching value
for the provided name
, the
test will be enabled.
Note: @IfProfileValue
can be applied at either the
class or method level.
Examples: when using SystemProfileValueSource
as the
ProfileValueSource
implementation, you can configure a test method to
run only on Java VMs from Sun Microsystems as follows:
@IfProfileValue
(name="java.vendor", value="Sun Microsystems Inc.")
testSomething() {
// ...
}
You can alternatively configure @IfProfileValue
with
OR semantics for multiple values
as follows
(assuming a ProfileValueSource
has been appropriately configured for
the "test-groups" name):
@IfProfileValue
(name="test-groups", values={"unit-tests", "integration-tests"})
public void testWhichRunsForUnitOrIntegrationTestGroups() {
// ...
}
ProfileValueSource
,
ProfileValueSourceConfiguration
,
ProfileValueUtils
,
AbstractAnnotationAwareTransactionalTests
,
AbstractJUnit38SpringContextTests
,
AbstractJUnit4SpringContextTests
,
SpringJUnit4ClassRunner
Required Element Summary | |
---|---|
String |
name
The name of the profile value against which to test. |
Optional Element Summary | |
---|---|
String |
value
A single, permissible value of the profile value
for the given name . |
String[] |
values
A list of all permissible values of the
profile value for the given name . |
Element Detail |
---|
public abstract String name
name
of the profile value against which to test.
public abstract String value
value
of the profile value
for the given name
.
Note: Assigning values to both value()
and values()
will lead to a configuration conflict.
public abstract String[] values
values
of the
profile value for the given name
.
Note: Assigning values to both value()
and values()
will lead to a configuration conflict.
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: REQUIRED | OPTIONAL | DETAIL: ELEMENT |