### Question:
RangeOperations { @SuppressWarnings("unchecked") public RangeNode<T> processRangeNodes(RangeNode<?> left, RangeNode<?> right, LogicalOperation logicalOperation) { RangeNode<T> firstRange = (RangeNode<T>) left; RangeNode<T> secondRange = (RangeNode<T>) right; if (logicalOperation.isAnd()) { return rangeNodeAnd(firstRange, secondRange); } else { return rangeNodeOr(firstRange, secondRange); } }  RangeList<T> and(Range<T> r1, Range<T> r2); RangeList<T> or(Range<T> r1, Range<T> r2); RangeNode<T> processFilterItem(FilterItem filterItem, String table, String columnName); RangeNode<T> rangeNodeOr(RangeNode<T> left, RangeNode<T> right); RangeNode<T> rangeNodeAnd(RangeNode<T> left, RangeNode<T> right); @SuppressWarnings("unchecked") RangeNode<T> processRangeNodes(RangeNode<?> left, RangeNode<?> right, LogicalOperation logicalOperation); abstract T getValue(String valueString); abstract T getMinValue(); abstract T getMaxValue(); abstract T add(T value, int step); abstract T subtract(T value, int step);  }### Answer:
@Test public void testProcessRangeNodesAnd() { RangeNode<Long> rangeNode1 = new RangeNode<>("table", "column"); rangeNode1.getRangeList().addAllRanges(new Range<>(1l, 5l), new Range<>(7l, 10l), new Range<>(13l, 18l)); RangeNode<Long> rangeNode2 = new RangeNode<>("table", "column"); rangeNode2.getRangeList().addAllRanges(new Range<>(8l, 9l), new Range<>(15l, 20l), new Range<>(22l, 25l), new Range<>(2l, 6l)); RangeNode<Long> actual = rangeOperations.processRangeNodes(rangeNode1, rangeNode2, new LogicalOperation(Operator.AND)); RangeNode<Long> expected = new RangeNode<Long>("table", "column"); expected.getRangeList().addAllRanges(new Range<>(2l, 5l), new Range<>(8l, 9l), new Range<>(15l, 18l)); assertEquals(expected, actual); }
@Test public void testProcessRangeNodesOr() { RangeNode<Long> rangeNode1 = new RangeNode<>("table", "column"); rangeNode1.getRangeList().addAllRanges(new Range<>(1l, 5l), new Range<>(7l, 10l), new Range<>(13l, 18l)); RangeNode<Long> rangeNode2 = new RangeNode<>("table", "column"); rangeNode2.getRangeList().addAllRanges(new Range<>(8l, 9l), new Range<>(15l, 20l), new Range<>(22l, 25l), new Range<>(2l, 6l)); RangeNode<Long> actual = rangeOperations.processRangeNodes(rangeNode1, rangeNode2, new LogicalOperation(Operator.OR)); RangeNode<Long> expected = new RangeNode<Long>("table", "column"); expected.getRangeList().addAllRanges(new Range<>(1l, 6l), new Range<>(13l, 20l), new Range<>(7l, 10l), new Range<>(22l, 25l)); assertEquals(expected, actual); }