ScriptFilterUtil { public static boolean filterOnFieldSets(Set<RequestData> fields, ScriptFilterCondition condition, ScriptStep currentStep, List<ScriptStep> steps) { if (StringUtils.isNotBlank(currentStep.getPayload())) { if (matchContition(condition, currentStep.getPayload())) { return true; } } if (fields == null) { return false; } if (fields.stream().map(field -> field.getKey() + "=" + field.getValue()) .anyMatch(filterField -> matchContition(condition, filterField))) { return true; } return (condition.getCondition().equals("Does not contain")) || (condition.getCondition().equals("Does not exist")); }  static List<ScriptStep> applyFilters(Collection<ScriptFilter> filters, List<ScriptStep> steps); static void applyFilters(List<Integer> filterIds, Script script); static void applyFiltersToScript(Collection<ScriptFilter> filters, Script script); static void applyFilter(ScriptFilter filter, List<ScriptStep> steps); static boolean filterOnField(String filterField, ScriptFilterCondition condition,
            ScriptStep currentStep); static boolean filterOnFieldSets(Set<RequestData> fields, ScriptFilterCondition condition,
            ScriptStep currentStep, List<ScriptStep> steps); static ScriptStep doAction(Set<ScriptFilterAction> actions, ScriptStep step);  }
@Test public void testFilterOnFieldSets_2() throws Exception { Set<RequestData> fields = null; ScriptFilterCondition condition = new ScriptFilterCondition(); ScriptStep currentStep = new ScriptStep(); List<ScriptStep> steps = new LinkedList(); boolean result = ScriptFilterUtil.filterOnFieldSets(fields, condition, currentStep, steps); assertEquals(false, result); }
@Test public void testFilterOnFieldSets_4() throws Exception { Set<RequestData> fields = new HashSet(); ScriptFilterCondition condition = new ScriptFilterCondition(); condition.setCondition("Does not contain"); ScriptStep currentStep = new ScriptStep(); List<ScriptStep> steps = new LinkedList(); boolean result = ScriptFilterUtil.filterOnFieldSets(fields, condition, currentStep, steps); assertEquals(true, result); }
@Test public void testFilterOnFieldSets_5() throws Exception { Set<RequestData> fields = new HashSet(); ScriptFilterCondition condition = new ScriptFilterCondition(); condition.setCondition(""); ScriptStep currentStep = new ScriptStep(); List<ScriptStep> steps = new LinkedList(); boolean result = ScriptFilterUtil.filterOnFieldSets(fields, condition, currentStep, steps); assertEquals(false, result); }
@Test public void testFilterOnFieldSets_6() throws Exception { Set<RequestData> fields = new HashSet(); ScriptFilterCondition condition = new ScriptFilterCondition(); condition.setCondition(""); ScriptStep currentStep = new ScriptStep(); List<ScriptStep> steps = new LinkedList(); boolean result = ScriptFilterUtil.filterOnFieldSets(fields, condition, currentStep, steps); assertEquals(false, result); }