### Question:
RangeOperations { public RangeList<T> and(Range<T> r1, Range<T> r2) { if (checkDiscrete(r1, r2)) { return null; } else { RangeList<T> rangeList = new RangeList<>(); T min = r1.getMin().compareTo(r2.getMin()) < 0 ? r2.getMin() : r1.getMin(); T max = r1.getMax().compareTo(r2.getMax()) < 0 ? r1.getMax() : r2.getMax(); rangeList.addRange(new Range<T>(min, max)); return rangeList; } }  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 testDiscreteAnd() { Range<Long> range1 = new Range<>(1l, 3l); Range<Long> range2 = new Range<Long>(4l, 5l); RangeList<Long> andRange = rangeOperations.and(range1, range2); assertNull(andRange); }
@Test public void testOverlappingAnd() { Range<Long> range1 = new Range<>(1l, 3l); Range<Long> range2 = new Range<Long>(2l, 5l); RangeList<Long> andRange = rangeOperations.and(range1, range2); RangeList<Long> expectedRangeList = new RangeList<>(); expectedRangeList.addRange(new Range<>(2l, 3l)); assertEquals(expectedRangeList, andRange); }
@Test public void testEdgeCaseAnd() { Range<Long> range1 = new Range<>(1l, 3l); Range<Long> range2 = new Range<Long>(3l, 5l); RangeList<Long> andRange = rangeOperations.and(range1, range2); RangeList<Long> expectedRangeList = new RangeList<>(); expectedRangeList.addRange(new Range<>(3l, 3l)); assertEquals(expectedRangeList, andRange); }
@Test public void testThreeDiscreteRangeAnd() { Range<Long> range1 = new Range<>(2l, 10l); Range<Long> raneg2 = new Range<>(3l, 8l); Range<Long> range3 = new Range<>(7l, 8l); RangeList<Long> threeAndRange = rangeOperations.and(range1, rangeOperations.and(raneg2, range3).getRanges().get(0)); assertNotNull(threeAndRange); }