@Test public void testCompare() throws Exception { AuditLogEntryComparator auditLogEntryComparator = new AuditLogEntryComparator(); HashMap<String, Integer> testCases = new HashMap<>(); testCases.put("firstname", 1); testCases.put("lastname", 0); testCases.put("user", 1); testCases.put("username", 1); testCases.put("userid", 1); testCases.put("mail", 1); testCases.put("action", -1); testCases.put("experiment", 0); testCases.put("bucket", -1); testCases.put("app", 0); testCases.put("time", -1); testCases.put("attribute", -1); testCases.put("before", -1); testCases.put("after", -1); testCases.put("description", -1); for (Map.Entry<String, Integer> testCase : testCases.entrySet()) { auditLogEntryComparator.replaceSortorder(testCase.getKey()); int magnitudeResult = auditLogEntryComparator.compare(auditLogEntry1, auditLogEntry2); if (magnitudeResult != 0) { magnitudeResult /= Math.abs(magnitudeResult); } Assert.assertEquals("test case " + testCase.getKey() + " failed.", testCase.getValue().intValue(), magnitudeResult); } }
@Override public int compare(AuditLogEntry left, AuditLogEntry right) { return super.compare(left, right, Property.class); }
AuditLogEntryComparator extends PaginationComparator<AuditLogEntry> { @Override public int compare(AuditLogEntry left, AuditLogEntry right) { return super.compare(left, right, Property.class); } }
AuditLogEntryComparator extends PaginationComparator<AuditLogEntry> { @Override public int compare(AuditLogEntry left, AuditLogEntry right) { return super.compare(left, right, Property.class); } AuditLogEntryComparator(); }
AuditLogEntryComparator extends PaginationComparator<AuditLogEntry> { @Override public int compare(AuditLogEntry left, AuditLogEntry right) { return super.compare(left, right, Property.class); } AuditLogEntryComparator(); @Override int compare(AuditLogEntry left, AuditLogEntry right); }
AuditLogEntryComparator extends PaginationComparator<AuditLogEntry> { @Override public int compare(AuditLogEntry left, AuditLogEntry right) { return super.compare(left, right, Property.class); } AuditLogEntryComparator(); @Override int compare(AuditLogEntry left, AuditLogEntry right);  }