BooleanConditionInspector extends ComparableConditionInspector { @Override public boolean isRedundant(final Object other) { if (this.equals(other)) { return true; } if (other instanceof BooleanConditionInspector) { switch (operator) { case EQUALS: switch (((BooleanConditionInspector) other).operator) { case EQUALS: return getValues().containsAll(((BooleanConditionInspector) other).getValues()); case NOT_EQUALS: return !getValue().equals(((BooleanConditionInspector) other).getValue()); default: return false; } case NOT_EQUALS: switch (((BooleanConditionInspector) other).operator) { case EQUALS: return !getValues().equals(((BooleanConditionInspector) other).getValues()); case NOT_EQUALS: return getValues().containsAll(((BooleanConditionInspector) other).getValues()); default: return false; } default: return false; } } else { return false; } } BooleanConditionInspector(final FieldCondition<Boolean> fieldCondition,
                                     final AnalyzerConfiguration configuration); @Override boolean isRedundant(final Object other); @Override boolean conflicts(final Object other); @Override boolean overlaps(final Object other); @Override boolean subsumes(final Object other); @Override String toHumanReadableString();  }
@Test public void parametrizedRedundancyTest() { BooleanConditionInspector a = getCondition(value1, operator1); BooleanConditionInspector b = getCondition(value2, operator2); assertEquals(getAssertDescription(a, b, !conflictExpected, "be redundant"), !conflictExpected, a.isRedundant(b)); assertEquals(getAssertDescription(b, a, !conflictExpected, "be redundant"), !conflictExpected, b.isRedundant(a)); }