### Question:
PotentialColumnComparator implements Comparator<PotentialColumn>, Serializable { @Override public int compare(PotentialColumn o1, PotentialColumn o2) { int o1MaxSuccesses = getMaxSuccesses(o1); int o2MaxSuccesses = getMaxSuccesses(o2); int compareValue = 0; if (o1MaxSuccesses > o2MaxSuccesses) { compareValue = -1; } else if (o2MaxSuccesses > o1MaxSuccesses) { compareValue = 1; } return compareValue; }  @Override int compare(PotentialColumn o1, PotentialColumn o2);  }### Answer:
@Test public void testCompare() { List<PotentialColumn> testData = New.list(); for (int i = 0; i < 3; i++) { PotentialColumn column = new PotentialColumn(); column.setColumnIndex(i); for (int j = 0; j < 3; j++) { SuccessfulFormat format = new SuccessfulFormat(); format.setNumberOfSuccesses(j * i); column.getFormats().put("format" + j, format); } testData.add(column); } Collections.sort(testData, new PotentialColumnComparator()); int index = testData.size() - 1; for (PotentialColumn column : testData) { assertEquals(index, column.getColumnIndex()); index--; } }