### Question:
RangeLongBlock implements Comparable<RangeLongBlock>, Iterable<Long> { public static RangeLongBlock merge(RangeLongBlock one, RangeLongBlock two) { RangeLongBlock merged = null; if (one.formsContiguousRange(two)) { long start = one.myStartValue < two.myStartValue ? one.myStartValue : two.myStartValue; long end = one.myEndValue > two.myEndValue ? one.myEndValue : two.myEndValue; merged = new RangeLongBlock(start, end); } return merged; } RangeLongBlock(long value);  RangeLongBlock(long startValue, long endValue);  RangeLongBlock(RangeLongBlock other); static List<RangeLongBlock> createRangeLongBlocks(Collection<? extends Long> values); static List<RangeLongBlock> createRangeLongBlocks(long[] values); static List<RangeLongBlock> createRangeLongBlocks(Long[] values); static List<RangeLongBlock> createSubBlocksByRemovingValue(RangeLongBlock block, long valueToRemove); static boolean isContiguous(long[] values); static RangeLongBlock merge(RangeLongBlock one, RangeLongBlock two); boolean borders(long value); boolean borders(RangeLongBlock block); @Override int compareTo(RangeLongBlock o); boolean containsValue(long value); @Override boolean equals(Object obj); boolean formsContiguousRange(RangeLongBlock other); long getEnd(); RangeRelationType getRelation(RangeLongBlock block); long getStart(); @Override int hashCode(); RangeLongBlock intersection(RangeLongBlock other); boolean isAfter(RangeLongBlock other); boolean isBefore(RangeLongBlock other); @Override Iterator<Long> iterator(); boolean overlaps(RangeLongBlock other); int size(); @Override String toString();  }### Answer:
@Test public void testMerge() { RangeLongBlock block = new RangeLongBlock(5, 10); RangeLongBlock before = new RangeLongBlock(1, 3); boolean hadIllegalArgumentException = false; try { block.merge(before); } catch (IllegalArgumentException e) { hadIllegalArgumentException = true; } Assert.assertTrue(hadIllegalArgumentException); RangeLongBlock borderBefore = new RangeLongBlock(1, 4); block = new RangeLongBlock(5, 10); block.merge(borderBefore); Assert.assertEquals(1, block.getStart()); Assert.assertEquals(10, block.getEnd()); RangeLongBlock overlapLeading = new RangeLongBlock(3, 5); block = new RangeLongBlock(5, 10); block.merge(overlapLeading); Assert.assertEquals(3, block.getStart()); Assert.assertEquals(10, block.getEnd()); RangeLongBlock equals = new RangeLongBlock(5, 10); block = new RangeLongBlock(5, 10); block.merge(equals); Assert.assertEquals(5, block.getStart()); Assert.assertEquals(10, block.getEnd()); RangeLongBlock subset = new RangeLongBlock(6, 9); block = new RangeLongBlock(5, 10); block.merge(subset); Assert.assertEquals(5, block.getStart()); Assert.assertEquals(10, block.getEnd()); RangeLongBlock superset = new RangeLongBlock(4, 11); block = new RangeLongBlock(5, 10); block.merge(superset); Assert.assertEquals(4, block.getStart()); Assert.assertEquals(11, block.getEnd()); RangeLongBlock overlapTrailing = new RangeLongBlock(9, 11); block = new RangeLongBlock(5, 10); block.merge(overlapTrailing); Assert.assertEquals(5, block.getStart()); Assert.assertEquals(11, block.getEnd()); RangeLongBlock borderAfter = new RangeLongBlock(11, 12); block = new RangeLongBlock(5, 10); block.merge(borderAfter); Assert.assertEquals(5, block.getStart()); Assert.assertEquals(12, block.getEnd()); block = new RangeLongBlock(5, 10); RangeLongBlock after = new RangeLongBlock(12, 13); hadIllegalArgumentException = false; try { block.merge(after); } catch (IllegalArgumentException e) { hadIllegalArgumentException = true; } Assert.assertTrue(hadIllegalArgumentException); }