@Test public void testIsConditionHeaderUniqueWhenHeaderIsInvalid() throws Exception { final ConditionCol52 conditionCol1 = fakeConditionCol52("header"); final ConditionCol52 conditionCol2 = fakeConditionCol52("header"); final Validator validator = new Validator(fakeCompositeColumn(conditionCol1, conditionCol2)); assertFalse(validator.isConditionHeaderUnique(conditionCol2)); }
public boolean isConditionHeaderUnique(final ConditionCol52 conditionCol52) { final String header = Optional.ofNullable(conditionCol52.getHeader()).orElse(""); final long occurrences = patternsConditions .stream() .flatMap(compositeColumn -> compositeColumn.getChildColumns().stream()) .filter(b -> header.equals(b.getHeader())) .count(); return occurrences == 1; }
Validator { public boolean isConditionHeaderUnique(final ConditionCol52 conditionCol52) { final String header = Optional.ofNullable(conditionCol52.getHeader()).orElse(""); final long occurrences = patternsConditions .stream() .flatMap(compositeColumn -> compositeColumn.getChildColumns().stream()) .filter(b -> header.equals(b.getHeader())) .count(); return occurrences == 1; } }
Validator { public boolean isConditionHeaderUnique(final ConditionCol52 conditionCol52) { final String header = Optional.ofNullable(conditionCol52.getHeader()).orElse(""); final long occurrences = patternsConditions .stream() .flatMap(compositeColumn -> compositeColumn.getChildColumns().stream()) .filter(b -> header.equals(b.getHeader())) .count(); return occurrences == 1; } Validator();  Validator(List<CompositeColumn<? extends BaseColumn>> patterns); }
Validator { public boolean isConditionHeaderUnique(final ConditionCol52 conditionCol52) { final String header = Optional.ofNullable(conditionCol52.getHeader()).orElse(""); final long occurrences = patternsConditions .stream() .flatMap(compositeColumn -> compositeColumn.getChildColumns().stream()) .filter(b -> header.equals(b.getHeader())) .count(); return occurrences == 1; } Validator();  Validator(List<CompositeColumn<? extends BaseColumn>> patterns); void addActionPattern(Pattern52 pattern); void removeActionPattern(Pattern52 pattern); boolean arePatternBindingsUnique(); boolean isPatternBindingUnique(Pattern52 pattern); boolean isPatternValid(Pattern52 p); boolean isConditionValid(ConditionCol52 c); boolean isConditionHeaderNotBlank(final ConditionCol52 c); boolean isConditionHeaderUnique(final ConditionCol52 conditionCol52); boolean isConditionOperatorValid(ConditionCol52 c); boolean isActionValid(ActionCol52 c); boolean isActionHeaderValid(ActionCol52 a); void setPatternToActionSetFieldsMap(Map<Pattern52, List<ActionSetFieldCol52>> patternToActionSetFieldsMap); boolean arePatternActionSetFieldsValid(Pattern52 p); void setPatternToActionInsertFactFieldsMap(Map<ActionInsertFactFieldsPattern, List<ActionInsertFactCol52>> patternToActionInsertFactFieldsMap); boolean arePatternActionInsertFactFieldsValid(Pattern52 p); boolean doesOperatorNeedValue(ConditionCol52 c); boolean doesOperatorAcceptValueList(ConditionCol52 c); boolean doesOperatorAcceptCommaSeparatedValues(ConditionCol52 c); boolean isConditionLimitedEntryValueValid(ConditionCol52 c); boolean canPatternBeRemoved(final Pattern52 pattern); boolean isTypeUsed(final String fqcn); }
Validator { public boolean isConditionHeaderUnique(final ConditionCol52 conditionCol52) { final String header = Optional.ofNullable(conditionCol52.getHeader()).orElse(""); final long occurrences = patternsConditions .stream() .flatMap(compositeColumn -> compositeColumn.getChildColumns().stream()) .filter(b -> header.equals(b.getHeader())) .count(); return occurrences == 1; } Validator();  Validator(List<CompositeColumn<? extends BaseColumn>> patterns); void addActionPattern(Pattern52 pattern); void removeActionPattern(Pattern52 pattern); boolean arePatternBindingsUnique(); boolean isPatternBindingUnique(Pattern52 pattern); boolean isPatternValid(Pattern52 p); boolean isConditionValid(ConditionCol52 c); boolean isConditionHeaderNotBlank(final ConditionCol52 c); boolean isConditionHeaderUnique(final ConditionCol52 conditionCol52); boolean isConditionOperatorValid(ConditionCol52 c); boolean isActionValid(ActionCol52 c); boolean isActionHeaderValid(ActionCol52 a); void setPatternToActionSetFieldsMap(Map<Pattern52, List<ActionSetFieldCol52>> patternToActionSetFieldsMap); boolean arePatternActionSetFieldsValid(Pattern52 p); void setPatternToActionInsertFactFieldsMap(Map<ActionInsertFactFieldsPattern, List<ActionInsertFactCol52>> patternToActionInsertFactFieldsMap); boolean arePatternActionInsertFactFieldsValid(Pattern52 p); boolean doesOperatorNeedValue(ConditionCol52 c); boolean doesOperatorAcceptValueList(ConditionCol52 c); boolean doesOperatorAcceptCommaSeparatedValues(ConditionCol52 c); boolean isConditionLimitedEntryValueValid(ConditionCol52 c); boolean canPatternBeRemoved(final Pattern52 pattern); boolean isTypeUsed(final String fqcn);  }