### Question:
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);  }### Answer:
@Test public void comparisonShouldReturnPositiveWhenFirstHostStronger() { assertTrue(hostStrengthComparator.compare( new Host((long) 1, "1", 2, 1, 1, false), new Host((long) 2, "2", 1, 1, 1, false)) > 0); }
@Test public void comparisonShouldReturnZeroWhenHostsEquallyStronger() { assertTrue(hostStrengthComparator.compare( new Host((long) 1, "1", 2, 1, 1, false), new Host((long) 2, "2", 2, 1, 1, false)) == 0); }
@Test public void comparisonShouldReturnNegativeWhenFirstHostWeaker() { assertTrue(hostStrengthComparator.compare( new Host((long) 1, "1", 1, 1, 1, false), new Host((long) 2, "2", 2, 1, 1, false)) < 0); }
@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); }
@Test public void comparisonShouldReturnNegativeWhenSecondHostWasOff() { assertTrue(hostStrengthComparator.compare( new Host((long) 1, "1", 2, 1, 1, false), new Host((long) 2, "2", 1, 1, 1, true)) < 0); }