### Question:
UniqueColumnCombinationResultComparator extends ResultComparator<UniqueColumnCombinationResult> { @Override protected int compare(UniqueColumnCombinationResult ucc1, UniqueColumnCombinationResult ucc2, String sortProperty) { if (COLUMN_COMBINATION_COLUMN.equals(sortProperty)) { return ucc1.getColumnCombination().toString() .compareTo(ucc2.getColumnCombination().toString()); } if (COLUMN_RATIO.equals(sortProperty)) { return Float.compare(ucc1.getColumnRatio(), ucc2.getColumnRatio()); } if (OCCURRENCE_RATIO.equals(sortProperty)) { return Float.compare(ucc1.getOccurrenceRatio(), ucc2.getOccurrenceRatio()); } if (UNIQUENESS_RATIO.equals(sortProperty)) { return Float.compare(ucc1.getUniquenessRatio(), ucc2.getUniquenessRatio()); } if (RANDOMNESS.equals(sortProperty)) { return Float.compare(ucc1.getRandomness(), ucc2.getRandomness()); } return 0; } UniqueColumnCombinationResultComparator(String sortProperty,
                                                 boolean isAscending);  static final String COLUMN_COMBINATION_COLUMN; static final String COLUMN_RATIO; static final String OCCURRENCE_RATIO; static final String UNIQUENESS_RATIO; static final String RANDOMNESS; }### Answer:
@Test public void compare1() { UniqueColumnCombinationResultComparator resultComparator = new UniqueColumnCombinationResultComparator( UniqueColumnCombinationResultComparator.COLUMN_COMBINATION_COLUMN, true); assertEquals(-1, resultComparator.compare(ucc1, ucc2)); }
@Test public void compare2() { UniqueColumnCombinationResultComparator resultComparator = new UniqueColumnCombinationResultComparator( UniqueColumnCombinationResultComparator.COLUMN_COMBINATION_COLUMN, false); assertEquals(1, resultComparator.compare(ucc1, ucc2)); }
@Test public void compare3() { UniqueColumnCombinationResultComparator resultComparator = new UniqueColumnCombinationResultComparator( UniqueColumnCombinationResultComparator.COLUMN_RATIO, true); assertTrue(resultComparator.compare(ucc1, ucc2) > 0); }
@Test public void compare4() { UniqueColumnCombinationResultComparator resultComparator = new UniqueColumnCombinationResultComparator( UniqueColumnCombinationResultComparator.COLUMN_RATIO, false); assertTrue(resultComparator.compare(ucc1, ucc2) < 0); }
@Test public void compare5() { UniqueColumnCombinationResultComparator resultComparator = new UniqueColumnCombinationResultComparator( UniqueColumnCombinationResultComparator.OCCURRENCE_RATIO, true); assertTrue(resultComparator.compare(ucc1, ucc2) < 0); }
@Test public void compare6() { UniqueColumnCombinationResultComparator resultComparator = new UniqueColumnCombinationResultComparator( UniqueColumnCombinationResultComparator.OCCURRENCE_RATIO, false); assertTrue(resultComparator.compare(ucc1, ucc2) > 0); }
@Test public void compare7() { UniqueColumnCombinationResultComparator resultComparator = new UniqueColumnCombinationResultComparator( UniqueColumnCombinationResultComparator.UNIQUENESS_RATIO, true); assertTrue(resultComparator.compare(ucc1, ucc2) < 0); }
@Test public void compare8() { UniqueColumnCombinationResultComparator resultComparator = new UniqueColumnCombinationResultComparator( UniqueColumnCombinationResultComparator.UNIQUENESS_RATIO, false); assertTrue(resultComparator.compare(ucc1, ucc2) > 0); }
@Test public void compare9() { UniqueColumnCombinationResultComparator resultComparator = new UniqueColumnCombinationResultComparator( UniqueColumnCombinationResultComparator.RANDOMNESS, true); assertTrue(resultComparator.compare(ucc1, ucc2) < 0); }
@Test public void compare10() { UniqueColumnCombinationResultComparator resultComparator = new UniqueColumnCombinationResultComparator( UniqueColumnCombinationResultComparator.RANDOMNESS, false); assertTrue(resultComparator.compare(ucc1, ucc2) > 0); }