### Question:
DirtySubsceneRemover { static Map<Integer, List<SamplingPoint>> splitByFileId(List<SamplingPoint> samples, boolean primary) { final Map<Integer, List<SamplingPoint>> samplesByDatafile = new TreeMap<>(); for (final SamplingPoint point : samples) { final int id = primary ? point.getReference() : point.getReference2(); if (!samplesByDatafile.containsKey(id)) { samplesByDatafile.put(id, new ArrayList<SamplingPoint>()); } samplesByDatafile.get(id).add(point); } return samplesByDatafile; } DirtySubsceneRemover(); DirtySubsceneRemover sensorName(); DirtySubsceneRemover primary(boolean primary); DirtySubsceneRemover subSceneWidth(int subSceneWidth); DirtySubsceneRemover subSceneHeight(int subSceneHeight); DirtySubsceneRemover dirtyPixelFraction(double dirtyPixelFraction); DirtySubsceneRemover config(Configuration config); DirtySubsceneRemover storage(Storage storage); DirtySubsceneRemover logger(Logger logger); boolean isPrimary(); void removeSamples(List<SamplingPoint> samples);  }### Answer:
@Test public void testSplitByFileId_oneFile_primary() { final List<SamplingPoint> points = new ArrayList<>(); points.add(createSamplingPointWithReference(19)); points.add(createSamplingPointWithReference(19)); final Map<Integer, List<SamplingPoint>> listByFileId = DirtySubsceneRemover.splitByFileId(points, true); assertEquals(1, listByFileId.size()); final List<SamplingPoint> fileList = listByFileId.get(19); assertNotNull(fileList); assertEquals(2, fileList.size()); }
@Test public void testSplitByFileId_oneFile_secondary() { final List<SamplingPoint> points = new ArrayList<>(); points.add(createSamplingPointWithSecondaryReference(21)); points.add(createSamplingPointWithSecondaryReference(21)); points.add(createSamplingPointWithSecondaryReference(21)); final Map<Integer, List<SamplingPoint>> listByFileId = DirtySubsceneRemover.splitByFileId(points, false); assertEquals(1, listByFileId.size()); final List<SamplingPoint> fileList = listByFileId.get(21); assertNotNull(fileList); assertEquals(3, fileList.size()); }
@Test public void testSplitByFileId_twoFiles_primary() { final List<SamplingPoint> points = new ArrayList<>(); points.add(createSamplingPointWithReference(22)); points.add(createSamplingPointWithReference(19)); points.add(createSamplingPointWithReference(22)); points.add(createSamplingPointWithReference(22)); points.add(createSamplingPointWithReference(19)); final Map<Integer, List<SamplingPoint>> listByFileId = DirtySubsceneRemover.splitByFileId(points, true); assertEquals(2, listByFileId.size()); List<SamplingPoint> fileList = listByFileId.get(19); assertNotNull(fileList); assertEquals(2, fileList.size()); fileList = listByFileId.get(22); assertNotNull(fileList); assertEquals(3, fileList.size()); }