### Question:
RegionOverlapFilter { List<List<SamplingPoint>> splitByOrbit(List<SamplingPoint> points) { final Map<Integer, List<SamplingPoint>> map = new HashMap<>(); for (final SamplingPoint point : points) { final int id = point.getReference(); if (!map.containsKey(id)) { map.put(id, new ArrayList<SamplingPoint>()); } map.get(id).add(point); } final ArrayList<List<SamplingPoint>> byOrbit = new ArrayList<>(map.size()); for (final List<SamplingPoint> orbitPoints : map.values()) { byOrbit.add(orbitPoints); } return byOrbit; } RegionOverlapFilter(int width, int height); List<SamplingPoint> apply(List<SamplingPoint> points);  }### Answer:
@Test public void testSplitByOrbit_emptyList() { final List<SamplingPoint> pointList = new ArrayList<>(); final List<List<SamplingPoint>> orbitLists = filter.splitByOrbit(pointList); assertNotNull(orbitLists); assertEquals(0, orbitLists.size()); }
@Test public void testSplitByOrbit_onePoint() { final List<SamplingPoint> pointList = new ArrayList<>(); addSamplePoint(34, pointList); final List<List<SamplingPoint>> orbitLists = filter.splitByOrbit(pointList); assertNotNull(orbitLists); assertEquals(1, orbitLists.size()); final List<SamplingPoint> orbitPoints = orbitLists.get(0); assertNotNull(orbitPoints); assertEquals(1, orbitPoints.size()); }
@Test public void testSplitByOrbit_twoPoints_sameOrbit() { final List<SamplingPoint> pointList = new ArrayList<>(); addSamplePoint(34, pointList); addSamplePoint(34, pointList); final List<List<SamplingPoint>> orbitLists = filter.splitByOrbit(pointList); assertNotNull(orbitLists); assertEquals(1, orbitLists.size()); final List<SamplingPoint> orbitPoints = orbitLists.get(0); assertNotNull(orbitPoints); assertEquals(2, orbitPoints.size()); }
@Test public void testSplitByOrbit_fivePoints_twoOrbits() { final List<SamplingPoint> pointList = new ArrayList<>(); addSamplePoint(34, pointList); addSamplePoint(34, pointList); addSamplePoint(34, pointList); addSamplePoint(67, pointList); addSamplePoint(67, pointList); final List<List<SamplingPoint>> byOrbit = filter.splitByOrbit(pointList); assertNotNull(byOrbit); assertEquals(2, byOrbit.size()); List<SamplingPoint> orbitPoints = byOrbit.get(0); assertNotNull(orbitPoints); assertEquals(3, orbitPoints.size()); orbitPoints = byOrbit.get(1); assertNotNull(orbitPoints); assertEquals(2, orbitPoints.size()); }
@Test public void testSplitByOrbit_twelvePoints_fourOrbits() { final List<SamplingPoint> pointList = new ArrayList<>(); addSamplePoint(34, pointList); addSamplePoint(23, pointList); addSamplePoint(34, pointList); addSamplePoint(23, pointList); addSamplePoint(67, pointList); addSamplePoint(83, pointList); addSamplePoint(67, pointList); addSamplePoint(83, pointList); addSamplePoint(67, pointList); addSamplePoint(83, pointList); addSamplePoint(23, pointList); addSamplePoint(34, pointList); final List<List<SamplingPoint>> orbitLists = filter.splitByOrbit(pointList); assertNotNull(orbitLists); assertEquals(4, orbitLists.size()); List<SamplingPoint> orbitPoints = orbitLists.get(0); assertNotNull(orbitPoints); assertEquals(3, orbitPoints.size()); orbitPoints = orbitLists.get(1); assertNotNull(orbitPoints); assertEquals(3, orbitPoints.size()); orbitPoints = orbitLists.get(2); assertNotNull(orbitPoints); assertEquals(3, orbitPoints.size()); orbitPoints = orbitLists.get(3); assertNotNull(orbitPoints); assertEquals(3, orbitPoints.size()); }