Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ public class CriteriaResponse {
protected Map<String, List<String>> entryWhen;

public CriteriaResponse() {
entryWhen = new HashMap<>();
}

public CriteriaResponse(final boolean result, final String reason, final Switcher switcher) {
this();
this.result = result;
this.reason = reason;
this.switcherKey = switcher.getSwitcherKey();
Expand All @@ -58,7 +60,7 @@ public CriteriaResponse buildFromSwitcher(Switcher switcher) {
}

private boolean isEntryMatching(Entry inputEntry) {
return entryWhen.containsKey(inputEntry.getStrategy()) &&
return entryWhen.isEmpty() || entryWhen.containsKey(inputEntry.getStrategy()) &&
entryWhen.get(inputEntry.getStrategy()).contains(inputEntry.getInput());
}

Expand Down Expand Up @@ -120,10 +122,6 @@ public CriteriaResponse when(StrategyValidator strategy, String input) {
}

public CriteriaResponse when(StrategyValidator strategy, List<String> inputs) {
if (entryWhen == null) {
entryWhen = new HashMap<>();
}

entryWhen.put(strategy.toString(), inputs);
return this;
}
Expand Down