Complete the code to enable the test only if the environment variable 'ENV' equals 'test'.
@EnabledIfEnvironmentVariable(named = "ENV", matches = "[1]") void testFeature() { // test code here }
The annotation @EnabledIfEnvironmentVariable activates the test only when the environment variable named 'ENV' matches the given value. Here, 'test' is the correct match.
Complete the code to enable the test only if the environment variable 'MODE' matches 'debug'.
@EnabledIfEnvironmentVariable(named = "MODE", matches = "[1]") void debugTest() { // debug test code }
The test runs only when the 'MODE' environment variable is set to 'debug'. This helps run debug-specific tests conditionally.
Fix the error in the annotation to enable the test only if the environment variable 'APP_ENV' equals 'production'.
@EnabledIfEnvironmentVariable(named = "APP_ENV", matches = "[1]") void productionTest() { // production test code }
The environment variable value is case-sensitive. 'production' in lowercase matches the expected value exactly.
Fill both blanks to enable the test only if the environment variable 'TEST_ENV' matches 'qa' and the method name is 'qaTest'.
@EnabledIfEnvironmentVariable(named = "[1]", matches = "[2]") void qaTest() { // QA environment test }
The annotation checks that the environment variable named 'TEST_ENV' matches 'qa' to enable this test method.
Fill all three blanks to enable the test only if the environment variable 'BUILD_TYPE' matches 'nightly' and the method name is 'nightlyBuildTest'.
@EnabledIfEnvironmentVariable(named = "[1]", matches = "[2]") void [3]() { // Nightly build test }
The test is enabled only when the 'BUILD_TYPE' environment variable equals 'nightly'. The method name must match 'nightlyBuildTest'.