Class AssumeTestGroupUtil
BeforeClass.
Methods whose names begin with 'assume' throw AssumptionViolatedException if the described assumption is not
met; otherwise they return normally. Other methods and constants in this class are meant for related use cases.
- Author:
- Josef Cacek, Brian Stansberry
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic voidAssume for tests that require a docker installation.static voidAssume for test failures when running against a full distribution.static voidassumeJDKVersionAfter(int javaSpecificationVersion) Assume for tests that fail when the JVM version is too low.static voidassumeJDKVersionBefore(int javaSpecificationVersion) Assume for tests that fail when the JVM version is too high.static voidAssume for tests that should not run against a WildFly Preview installation.static voidAssume for tests that fail when the security manager is enabled.static voidassumeSecurityManagerDisabledOrAssumeJDKVersionBefore(int javaSpecificationVersion) Assume for tests that fail when the security manager is enabled or the JDK version is prior to a given versionstatic voidstatic org.jboss.shrinkwrap.api.spec.EnterpriseArchiveemptyEar()Creates an empty (except for a manifest) EnterpriseArchive with the nameempty.ear.static org.jboss.shrinkwrap.api.spec.EnterpriseArchiveCreates an empty (except for a manifest) EnterpriseArchive with the given name.static org.jboss.shrinkwrap.api.spec.JavaArchiveemptyJar()Creates an empty (except for a manifest) JavaArchive with the nameempty.jar.static org.jboss.shrinkwrap.api.spec.JavaArchiveCreates an empty (except for a manifest) JavaArchive with the given name.static org.jboss.shrinkwrap.api.spec.WebArchiveemptyWar()Creates an empty (except for a manifest) WebArchive with the nameempty.war.static org.jboss.shrinkwrap.api.spec.WebArchiveCreates an empty (except for a manifest) WebArchive with the given name.static booleanstatic booleanChecks whether a docker installation is available.static booleanChecks whether tests are running against a full distribution.static booleanisJDKVersionAfter(int javaSpecificationVersion) Check if the current JDK specification version is greater than the given value.static booleanisJDKVersionBefore(int javaSpecificationVersion) Check if the current JDK specification version is less than the given value.static booleanCheck if the JDK Security Manager is disabled.static booleanCheck if the JDK Security Manager is enabled/strong>.static boolean
-
Constructor Details
-
AssumeTestGroupUtil
public AssumeTestGroupUtil()
-
-
Method Details
-
emptyJar
public static org.jboss.shrinkwrap.api.spec.JavaArchive emptyJar()Creates an empty (except for a manifest) JavaArchive with the nameempty.jar.- Returns:
- the archive
-
emptyJar
Creates an empty (except for a manifest) JavaArchive with the given name.- Parameters:
name- the jar name. Can end with the '.jar' extension, but if not it will be added- Returns:
- the archive
-
emptyWar
public static org.jboss.shrinkwrap.api.spec.WebArchive emptyWar()Creates an empty (except for a manifest) WebArchive with the nameempty.war.- Returns:
- the archive
-
emptyWar
Creates an empty (except for a manifest) WebArchive with the given name.- Parameters:
name- the jar name. Can end with the '.war' extension, but if not it will be added- Returns:
- the archive
-
emptyEar
public static org.jboss.shrinkwrap.api.spec.EnterpriseArchive emptyEar()Creates an empty (except for a manifest) EnterpriseArchive with the nameempty.ear.- Returns:
- the archive
-
emptyEar
Creates an empty (except for a manifest) EnterpriseArchive with the given name.- Parameters:
name- the jar name. Can end with the '.ear' extension, but if not it will be added- Returns:
- the archive
-
assumeSecurityManagerDisabled
public static void assumeSecurityManagerDisabled()Assume for tests that fail when the security manager is enabled. This should be used sparingly and issues should be filed for failing tests so a proper fix can be done.Note that this checks the
security.managersystem property and not that theSystem.getSecurityManager()isnull. The property is checked so that the assumption check can be done in a@Beforeor@BeforeClassmethod.- Throws:
org.junit.AssumptionViolatedException- if the security manager is enabled
-
isSecurityManagerEnabled
public static boolean isSecurityManagerEnabled()Check if the JDK Security Manager is enabled/strong>.Note that this checks the
security.managersystem property and not that theSystem.getSecurityManager()is notnull. The property is checked so that the assumption check can be done in a@Beforeor@BeforeClassmethod.- Returns:
trueif thesecurity.managersystem property is null.
-
isSecurityManagerDisabled
public static boolean isSecurityManagerDisabled()Check if the JDK Security Manager is disabled.Note that this checks the
security.managersystem property and not that theSystem.getSecurityManager()isnull. The property is checked so that the assumption check can be done in a@Beforeor@BeforeClassmethod.- Returns:
trueif thesecurity.managersystem property is null.
-
assumeSecurityManagerDisabledOrAssumeJDKVersionBefore
public static void assumeSecurityManagerDisabledOrAssumeJDKVersionBefore(int javaSpecificationVersion) Assume for tests that fail when the security manager is enabled or the JDK version is prior to a given versionNote that this checks the
security.managersystem property and not that theSystem.getSecurityManager()isnull. The property is checked so that the assumption check can be done in a@Beforeor@BeforeClassmethod.- Parameters:
javaSpecificationVersion- the JDK specification version- Throws:
org.junit.AssumptionViolatedException- if the security manager is enabled or the JDK version is greater than or equal tojavaSpecificationVersion
-
assumeJDKVersionAfter
public static void assumeJDKVersionAfter(int javaSpecificationVersion) Assume for tests that fail when the JVM version is too low. This should be used sparingly.- Parameters:
javaSpecificationVersion- the JDK specification version. Use 8 for JDK 8. Must be 8 or higher.- Throws:
org.junit.AssumptionViolatedException- if the JDK version is less than or equal tojavaSpecificationVersion
-
assumeJDKVersionBefore
public static void assumeJDKVersionBefore(int javaSpecificationVersion) Assume for tests that fail when the JVM version is too high. This should be used sparingly.- Parameters:
javaSpecificationVersion- the JDK specification version. Must be 9 or higher.- Throws:
org.junit.AssumptionViolatedException- if the JDK version is greater than or equal tojavaSpecificationVersion
-
isJDKVersionAfter
public static boolean isJDKVersionAfter(int javaSpecificationVersion) Check if the current JDK specification version is greater than the given value.- Parameters:
javaSpecificationVersion- the JDK specification version. Use 8 for JDK 8.
-
isJDKVersionBefore
public static boolean isJDKVersionBefore(int javaSpecificationVersion) Check if the current JDK specification version is less than the given value.- Parameters:
javaSpecificationVersion- the JDK specification version. Use 8 for JDK 8.
-
assumeFullDistribution
public static void assumeFullDistribution()Assume for test failures when running against a full distribution. Full distributions are available from build/dist modules. It skips tests in case'-Dtestsuite.default.build.project.prefix'Maven argument is used with a non empty value, e.g. testsuite.default.build.project.prefix=ee- which means we are using ee-build/ee-dist modules as the source where to find the server under test.- Throws:
org.junit.AssumptionViolatedException- if propertytestsuite.default.build.project.prefixis set to a non-empty value
-
isFullDistribution
public static boolean isFullDistribution()Checks whether tests are running against a full distribution. Full distributions are available from build/dist modules. It skips tests in case'-Dtestsuite.default.build.project.prefix'Maven argument is used with a non empty value, e.g. testsuite.default.build.project.prefix=ee- which means we are using ee-build/ee-dist modules as the source where to find the server under test. -
assumeDockerAvailable
public static void assumeDockerAvailable()Assume for tests that require a docker installation.- Throws:
org.junit.AssumptionViolatedException- if a docker client cannot be initializedRuntimeException- if a docker client is required but is unavailable or not properly configured
-
isDockerAvailable
public static boolean isDockerAvailable()Checks whether a docker installation is available.- Throws:
org.junit.AssumptionViolatedException- if a docker client cannot be initialized
-
assumeNotWildFlyPreview
public static void assumeNotWildFlyPreview()Assume for tests that should not run against a WildFly Preview installation.- Throws:
org.junit.AssumptionViolatedException- if one of the system properties that indicates WildFly Preview is being tested is set
-
assumeWildFlyPreview
public static void assumeWildFlyPreview() -
isWildFlyPreview
public static boolean isWildFlyPreview() -
assumeBootableJar
public static void assumeBootableJar() -
isBootableJar
public static boolean isBootableJar()
-