@Test public void comparisonShouldReturnPositiveWhenFirstHostWasOff() { assertTrue(hostStrengthComparator.compare( new Host((long) 1, "1", 1, 1, 1, true), new Host((long) 2, "2", 2, 1, 1, false)) > 0); }
@Override public int compare(Host host1, Host host2) { if (host1.wasOffInitiallly() && !host2.wasOffInitiallly()) { return 1; } else if (!host1.wasOffInitiallly() && host2.wasOffInitiallly()) { return -1; } return Double.compare(strength(host1), strength(host2)); }
HostStrengthComparator implements Comparator<Host>, Serializable { @Override public int compare(Host host1, Host host2) { if (host1.wasOffInitiallly() && !host2.wasOffInitiallly()) { return 1; } else if (!host1.wasOffInitiallly() && host2.wasOffInitiallly()) { return -1; } return Double.compare(strength(host1), strength(host2)); } }
HostStrengthComparator implements Comparator<Host>, Serializable { @Override public int compare(Host host1, Host host2) { if (host1.wasOffInitiallly() && !host2.wasOffInitiallly()) { return 1; } else if (!host1.wasOffInitiallly() && host2.wasOffInitiallly()) { return -1; } return Double.compare(strength(host1), strength(host2)); }  }
HostStrengthComparator implements Comparator<Host>, Serializable { @Override public int compare(Host host1, Host host2) { if (host1.wasOffInitiallly() && !host2.wasOffInitiallly()) { return 1; } else if (!host1.wasOffInitiallly() && host2.wasOffInitiallly()) { return -1; } return Double.compare(strength(host1), strength(host2)); }  @Override int compare(Host host1, Host host2); }
HostStrengthComparator implements Comparator<Host>, Serializable { @Override public int compare(Host host1, Host host2) { if (host1.wasOffInitiallly() && !host2.wasOffInitiallly()) { return 1; } else if (!host1.wasOffInitiallly() && host2.wasOffInitiallly()) { return -1; } return Double.compare(strength(host1), strength(host2)); }  @Override int compare(Host host1, Host host2);  }