### Question:
FunctionalDependencyRanking extends Ranking { protected void calculatePollution(FunctionalDependencyResult result, TableInformation tableInformation) throws InputGenerationException, InputIterationException { if (result.getGeneralCoverage() == 1.0) { result.setPollution(0.0f); result.setPollutionColumn(""); return; } BitSet candidateSet = new BitSet(tableInformation.getColumnCount()); candidateSet.or(result.getExtendedDependantAsBitSet()); candidateSet.or(result.getDeterminantAsBitSet()); candidateSet.flip(0, tableInformation.getColumnCount()); float minKeyError = -1; for (int columnIndex = candidateSet.nextSetBit(0); columnIndex != -1; columnIndex = candidateSet.nextSetBit(columnIndex + 1)) { BitSet testColumn = new BitSet(); testColumn.set(columnIndex); BitSet columnsToTest = (BitSet) result.getDeterminantAsBitSet().clone(); columnsToTest.or(testColumn); float keyError = Math.abs(calculateKeyError(columnsToTest) - calculateKeyError(result.getDeterminantAsBitSet())); minKeyError = (minKeyError == -1) ? keyError : Math.min(minKeyError, keyError); if (minKeyError == keyError) { result.setPollutionColumn(tableInformation.getColumn(columnIndex).getColumnName()); } } result.setPollution(minKeyError / (float) tableInformation.getRowCount()); } FunctionalDependencyRanking(List<FunctionalDependencyResult> results,
                                     Map<String, TableInformation> tableInformationMap); @Override void calculateDataIndependentRankings(); @Override void calculateDataDependentRankings(); Map<BitSet, PositionListIndex> createPLIs(TableInformation tableInformation);  }### Answer:
@Test public void testCalculatePollution() throws Exception { setUpPollution(); FunctionalDependencyRanking ranking = new FunctionalDependencyRanking(functionalDependencyResults, tableInformationMap); FunctionalDependencyResult result = functionalDependencyResults.get(1); TableInformation tableInformation = tableInformationMap.values().iterator().next(); Map<BitSet, PositionListIndex> plis = ranking.createPLIs(tableInformation); ranking.PLIs = plis; ranking.calculatePollution(result, tableInformation); assertEquals(0.4, result.getPollution(), 0.01); assertEquals("D", result.getPollutionColumn()); }