diff --git a/src/main/java/com/github/switcherapi/client/model/response/CriteriaResponse.java b/src/main/java/com/github/switcherapi/client/model/response/CriteriaResponse.java index c0c6715d..9d99d2ad 100644 --- a/src/main/java/com/github/switcherapi/client/model/response/CriteriaResponse.java +++ b/src/main/java/com/github/switcherapi/client/model/response/CriteriaResponse.java @@ -33,9 +33,11 @@ public class CriteriaResponse { protected Map> 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(); @@ -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()); } @@ -120,10 +122,6 @@ public CriteriaResponse when(StrategyValidator strategy, String input) { } public CriteriaResponse when(StrategyValidator strategy, List inputs) { - if (entryWhen == null) { - entryWhen = new HashMap<>(); - } - entryWhen.put(strategy.toString(), inputs); return this; }