Skip to content

Commit c58f0b9

Browse files
refactor: always preprocess rules in TestGenerator
1 parent 24d1252 commit c58f0b9

File tree

1 file changed

+5
-20
lines changed

1 file changed

+5
-20
lines changed

src/main/java/io/github/mikeddavydov/jpwise/core/TestGenerator.java

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -59,39 +59,24 @@
5959
*/
6060
public class TestGenerator {
6161
private static final Logger logger = LoggerFactory.getLogger(TestGenerator.class);
62-
private static final boolean SHOULD_PREPROCESS_RULES;
6362

64-
static {
65-
// Allow overriding via system property, default to true
66-
SHOULD_PREPROCESS_RULES = Boolean.parseBoolean(System.getProperty("jpwise.preprocessRules", "true"));
67-
}
68-
69-
private final TestInput input; // The effective TestInput after potential preprocessing
63+
private final TestInput input; // The effective TestInput after preprocessing
7064
private final List<TestParameter> parameters; // Derived from the effective input
7165
private CombinationTable result; // Holds the generated combinations
7266
private final RulePreprocessor rulePreprocessor;
7367

7468
/**
7569
* Initializes a new TestGenerator with the provided test input.
76-
* If rule preprocessing is enabled (default), a new preprocessed TestInput will
77-
* be used internally.
70+
* A new preprocessed TestInput will be used internally.
7871
*
7972
* @param initialInput The initial TestInput.
8073
*/
8174
public TestGenerator(TestInput initialInput) {
8275
Objects.requireNonNull(initialInput, "Initial TestInput cannot be null");
8376

84-
if (SHOULD_PREPROCESS_RULES) {
85-
logger.info("Rule preprocessing is enabled. Preprocessing initial input.");
86-
this.rulePreprocessor = new RulePreprocessor();
87-
this.input = this.rulePreprocessor.preprocess(initialInput);
88-
} else {
89-
logger.info("Rule preprocessing is disabled. Using initial input as is.");
90-
// We could do 'this.input = new TestInput(initialInput);' for a defensive copy,
91-
// but if initialInput is not modified elsewhere, direct assignment is fine.
92-
this.rulePreprocessor = null;
93-
this.input = initialInput;
94-
}
77+
logger.info("Rule preprocessing is enabled by default. Preprocessing initial input.");
78+
this.rulePreprocessor = new RulePreprocessor();
79+
this.input = this.rulePreprocessor.preprocess(initialInput);
9580

9681
this.parameters = this.input.getTestParameters();
9782
if (this.parameters.isEmpty()) {

0 commit comments

Comments
 (0)