### Question:
CompactionPlan { public final void validate(Set<StoredTabletFile> allFiles) { Set<TabletFile> inputSet = new HashSet<>(inputFiles); Set<StoredTabletFile> deleteSet = new HashSet<>(deleteFiles); if (!allFiles.containsAll(inputSet)) { inputSet.removeAll(allFiles); throw new IllegalStateException("plan inputs contains files not in allFiles " + inputSet); } if (!allFiles.containsAll(deleteSet)) { deleteSet.removeAll(allFiles); throw new IllegalStateException("plan deletes contains files not in allFiles " + deleteSet); } if (!Collections.disjoint(inputSet, deleteSet)) { throw new IllegalStateException("plan contains overlap in inputFiles and deleteFiles " + Sets.intersection(inputSet, deleteSet)); } }  @Override String toString(); final void validate(Set<StoredTabletFile> allFiles); final List<StoredTabletFile> inputFiles; final List<StoredTabletFile> deleteFiles; public WriteParameters writeParameters; }### Answer:
@Test public void testOverlappingInputAndDelete() { CompactionPlan cp1 = new CompactionPlan(); StoredTabletFile fr1 = new StoredTabletFile("hdfs: StoredTabletFile fr2 = new StoredTabletFile("hdfs: cp1.inputFiles.add(fr1); cp1.deleteFiles.add(fr1); cp1.deleteFiles.add(fr2); Set<StoredTabletFile> allFiles = Set.of(fr1, fr2); assertThrows(IllegalStateException.class, () -> cp1.validate(allFiles)); }
@Test public void testInputNotInAllFiles() { CompactionPlan cp1 = new CompactionPlan(); StoredTabletFile fr1 = new StoredTabletFile("hdfs: StoredTabletFile fr2 = new StoredTabletFile("hdfs: StoredTabletFile fr3 = new StoredTabletFile("hdfs: cp1.inputFiles.add(fr1); cp1.inputFiles.add(fr2); cp1.inputFiles.add(fr3); Set<StoredTabletFile> allFiles = Set.of(fr1, fr2); assertThrows(IllegalStateException.class, () -> cp1.validate(allFiles)); }
@Test public void testDeleteNotInAllFiles() { CompactionPlan cp1 = new CompactionPlan(); StoredTabletFile fr1 = new StoredTabletFile("hdfs: StoredTabletFile fr2 = new StoredTabletFile("hdfs: StoredTabletFile fr3 = new StoredTabletFile("hdfs: cp1.deleteFiles.add(fr1); cp1.deleteFiles.add(fr2); cp1.deleteFiles.add(fr3); Set<StoredTabletFile> allFiles = Set.of(fr1, fr2); assertThrows(IllegalStateException.class, () -> cp1.validate(allFiles)); }