spring-framework / org.springframework.test.annotation / ProfileValueUtils

ProfileValueUtils

abstract class ProfileValueUtils

General utility methods for working with profile values.

Author
Sam Brannen

Author
Juergen Hoeller

Since
2.5

See Also
ProfileValueSourceProfileValueSourceConfigurationIfProfileValue

Constructors

<init>

ProfileValueUtils()

General utility methods for working with profile values.

Functions

isTestEnabledInThisEnvironment

open static fun isTestEnabledInThisEnvironment(testClass: Class<*>): Boolean

Determine if the supplied testClass is enabled in the current environment, as specified by the IfProfileValue annotation at the class level.

Defaults to true if no IfProfileValue annotation is declared.

open static fun isTestEnabledInThisEnvironment(testMethod: Method, testClass: Class<*>): Boolean
open static fun isTestEnabledInThisEnvironment(profileValueSource: ProfileValueSource, testMethod: Method, testClass: Class<*>): Boolean

Determine if the supplied testMethod is enabled in the current environment, as specified by the IfProfileValue annotation, which may be declared on the test method itself or at the class level. Class-level usage overrides method-level usage.

Defaults to true if no IfProfileValue annotation is declared.

retrieveProfileValueSource

open static fun retrieveProfileValueSource(testClass: Class<*>): ProfileValueSource

Retrieves the ProfileValueSource type for the specified Class as configured via the ProfileValueSourceConfiguration annotation and instantiates a new instance of that type.

If ProfileValueSourceConfiguration is not present on the specified class or if a custom ProfileValueSource is not declared, the default SystemProfileValueSource will be returned instead.