diff --git a/serenity-model/src/main/java/net/thucydides/model/requirements/AggregateRequirements.java b/serenity-model/src/main/java/net/thucydides/model/requirements/AggregateRequirements.java index 786ab689a..8e0200714 100644 --- a/serenity-model/src/main/java/net/thucydides/model/requirements/AggregateRequirements.java +++ b/serenity-model/src/main/java/net/thucydides/model/requirements/AggregateRequirements.java @@ -22,8 +22,10 @@ public class AggregateRequirements implements Requirements { private final RequirementsOutcomeFactory requirementsOutcomeFactory; public AggregateRequirements(Path jsonOutcomes, String featureFilesDirectory) { - EnvironmentVariables environmentVariables = SystemEnvironmentVariables.currentEnvironmentVariables(); + this(jsonOutcomes, featureFilesDirectory, SystemEnvironmentVariables.createEnvironmentVariables()); + } + public AggregateRequirements(Path jsonOutcomes, String featureFilesDirectory, EnvironmentVariables environmentVariables) { this.requirementsService = new AggregateRequirementsService( environmentVariables, new FileSystemRequirementsTagProvider(featureFilesDirectory, environmentVariables), diff --git a/serenity-model/src/test/java/net/thucydides/model/requirements/AggregateRequirementsTest.java b/serenity-model/src/test/java/net/thucydides/model/requirements/AggregateRequirementsTest.java index 00139ff7a..a57b7e056 100644 --- a/serenity-model/src/test/java/net/thucydides/model/requirements/AggregateRequirementsTest.java +++ b/serenity-model/src/test/java/net/thucydides/model/requirements/AggregateRequirementsTest.java @@ -2,7 +2,10 @@ import net.serenitybdd.model.environment.ConfiguredEnvironment; import net.thucydides.model.domain.RequirementCache; +import net.thucydides.model.environment.MockEnvironmentVariables; +import net.thucydides.model.environment.SystemEnvironmentVariables; import net.thucydides.model.requirements.model.Requirement; +import net.thucydides.model.util.EnvironmentVariables; import org.junit.jupiter.api.*; import java.io.File; @@ -107,7 +110,13 @@ private List requirementsFrom(Path exampleRootDirectory) { Path requirementsDirectory = exampleRootDirectory.resolve("spec"); Path jsonOutcomesDirectory = exampleRootDirectory.resolve("outcomes"); - Requirements requirements = new AggregateRequirements(jsonOutcomesDirectory, requirementsDirectory.toString()); + EnvironmentVariables environmentVariables = new MockEnvironmentVariables(); + + Requirements requirements = new AggregateRequirements( + jsonOutcomesDirectory, + requirementsDirectory.toString(), + environmentVariables + ); return requirements.getRequirementsService().getRequirements(); }