### Question:
ResultCache extends ResultReceiver { @Override public void close() throws IOException { ResultPrinter printer = new ResultPrinter(this.algorithmExecutionIdentifier, this.acceptedColumns, this.testDirectory); for (Result result : results) { try { if (result instanceof FunctionalDependency) { printer.receiveResult((FunctionalDependency) result); } else if (result instanceof MatchingDependency) { printer.receiveResult((MatchingDependency) result); } else if (result instanceof ConditionalFunctionalDependency) { printer.receiveResult((ConditionalFunctionalDependency) result); } else if (result instanceof MultivaluedDependency) { printer.receiveResult((MultivaluedDependency) result); } else if (result instanceof InclusionDependency) { printer.receiveResult((InclusionDependency) result); } else if (result instanceof UniqueColumnCombination) { printer.receiveResult((UniqueColumnCombination) result); } else if (result instanceof ConditionalUniqueColumnCombination) { printer.receiveResult((ConditionalUniqueColumnCombination) result); } else if (result instanceof OrderDependency) { printer.receiveResult((OrderDependency) result); } else if (result instanceof BasicStatistic) { printer.receiveResult((BasicStatistic) result); } else if (result instanceof DenialConstraint) { printer.receiveResult((DenialConstraint) result); } } catch (CouldNotReceiveResultException e) { e.printStackTrace(); } catch (ColumnNameMismatchException ignored) { } } printer.close(); } ResultCache(String algorithmExecutionIdentifier, List<ColumnIdentifier> acceptedColumns); protected  ResultCache(String algorithmExecutionIdentifier, List<ColumnIdentifier> acceptedColumns, Boolean test); @Override void receiveResult(BasicStatistic statistic); @Override void receiveResult(FunctionalDependency functionalDependency); @Override void receiveResult(MatchingDependency matchingDependency); @Override void receiveResult(ConditionalFunctionalDependency conditionalFunctionalDependency); @Override void receiveResult(MultivaluedDependency multivaluedDependency); @Override void receiveResult(InclusionDependency inclusionDependency); @Override void receiveResult(UniqueColumnCombination uniqueColumnCombination); void receiveResult(ConditionalUniqueColumnCombination conditionalUniqueColumnCombination); @Override void receiveResult(OrderDependency orderDependency); @Override void receiveResult(DenialConstraint denialConstraint); @Override void receiveResult(ConditionalInclusionDependency conditionalDependency); List<Result> fetchNewResults(); @Override void close();  }### Answer:
@Test public void testClose() throws IOException, CouldNotReceiveResultException, ColumnNameMismatchException { FunctionalDependency expectedFd = new FunctionalDependency( new ColumnCombination( new ColumnIdentifier("table1", "column2")), new ColumnIdentifier("table1", "column23") ); Map<String, String> tableMapping = new HashMap<>(); tableMapping.put("table1", "1"); Map<String, String> columnMapping = new HashMap<>(); columnMapping.put("1.column2", "1"); columnMapping.put("1.column23", "2"); List<ColumnIdentifier> acceptableColumnNames = new ArrayList<>(); acceptableColumnNames.add(new ColumnIdentifier("table1", "column2")); acceptableColumnNames.add(new ColumnIdentifier("table1", "column23")); ResultCache resultCache = new ResultCache("identifier", acceptableColumnNames); resultCache.setResultTestDir(); resultCache.receiveResult(expectedFd); resultCache.close(); File actualFile = new File(resultCache.getOutputFilePathPrefix() + ResultType.FD.getEnding()); assertTrue(actualFile.exists()); String fileContent = Files.toString(actualFile, Charsets.UTF_8); assertTrue(fileContent.contains(expectedFd.toString(tableMapping, columnMapping))); FileUtils.deleteDirectory(new File(ResultPrinter.RESULT_TEST_DIR).getParentFile()); }