Slackbot
07/25/2022, 4:41 PMSuraj Singh
07/25/2022, 4:54 PM@BeforeClass
public static void assumeFeatureFlag() {
assumeTrue("Feature flag is enabled", Boolean.parseBoolean(System.getProperty(FeatureFlags.REP_TYPE)));
}
Suraj Singh
07/25/2022, 5:19 PMVampire
07/26/2022, 7:31 AMThomas Broyer
07/26/2022, 9:15 AMBoolean.parseBoolean(System.getProperty(…))
is equivalent to Boolean.getBoolean(…)
• To set the system property for your tests, configure it on your test task: https://docs.gradle.org/current/dsl/org.gradle.api.tasks.testing.Test.htmlVampire
07/26/2022, 10:16 AM@BeforeClass
method using System.setProperty
and maybe resets it to the previous value in @AfterClass
.
With Spock as testing framework this could simple be done using a @ResetSystemProperties
Annotation on the test. 🙂