### Question:
Region { public boolean overlap(int position) { return overlap(new PointRegion(null, position)); } Region(T data); abstract int getStart(); abstract int getEnd(); int getMinPosition(); int getMaxPosition(); T getData(); boolean sameRegion(Region other); boolean overlap(int position); boolean overlap(int position, boolean insertionAware); boolean overlap(Region other); boolean overlap(Region other, boolean insertionAware); boolean coveredBy(Region other); int getLength(); int getCoveredPositions();  }### Answer:
@Test public void overlapPosition() throws Exception { assertFalse(new PointRegion("x",122).overlap(123)); assertTrue(new PointRegion("x",123).overlap(123)); assertFalse(new PointRegion("x",124).overlap(123)); assertFalse(new PointRegion("x",123).overlap(122)); assertFalse(new PointRegion("x",123).overlap(124)); RegionImpl reg = new RegionImpl("x", 122, 124); assertFalse(reg.overlap(121)); assertTrue(reg.overlap(122)); assertTrue(reg.overlap(123)); assertTrue(reg.overlap(124)); assertFalse(reg.overlap(125)); }
@Test public void overlapRegion() throws Exception { RegionImpl query = new RegionImpl("x", 122, 125); assertFalse(new PointRegion("x",121).overlap(query)); assertTrue(new PointRegion("x",122).overlap(query)); assertTrue(new PointRegion("x",125).overlap(query)); assertFalse(new PointRegion("x",126).overlap(query)); assertFalse(new RegionImpl("x", 100, 121).overlap(query)); assertTrue(new RegionImpl("x", 100, 122).overlap(query)); assertTrue(new RegionImpl("x", 100, 200).overlap(query)); assertTrue(new RegionImpl("x", 123, 124).overlap(query)); assertTrue(new RegionImpl("x", 125, 200).overlap(query)); assertFalse(new RegionImpl("x", 126, 200).overlap(query)); }
@Test public void overlapINSERTION() throws Exception { Region insertion = new RegionImpl("x", 100, 99); assertFalse(insertion.overlap(98)); assertTrue(insertion.overlap(99)); assertTrue(insertion.overlap(100)); assertFalse(insertion.overlap(101)); }
@Test public void overlapStrictINSERTION() throws Exception { Region insertion = new RegionImpl("x", 100, 99); assertFalse(insertion.overlap(98, true)); assertFalse(insertion.overlap(99, true)); assertTrue(insertion.overlap(100, true)); assertFalse(insertion.overlap(101, true)); assertFalse(insertion.overlap(new RegionImpl("x", 97, 98), true)); assertFalse(insertion.overlap(new RegionImpl("x", 97, 99), true)); assertTrue(insertion.overlap(new RegionImpl("x", 97, 100), true)); assertTrue(insertion.overlap(new RegionImpl("x", 98, 101), true)); assertTrue(insertion.overlap(new RegionImpl("x", 98, 100), true)); assertTrue(insertion.overlap(new RegionImpl("x", 99, 100), true)); assertTrue(insertion.overlap(new RegionImpl("x", 100, 100), true)); assertTrue(insertion.overlap(new RegionImpl("x", 100, 101), true)); assertFalse(insertion.overlap(new RegionImpl("x", 101, 102), true)); assertTrue(insertion.overlap(insertion, true)); }