### Question:
HAHealthCheckFrontEnd extends HARenderer { @Override public int compareTo(HAConfigurationSection o) { if (!(o instanceof HAHealthCheckFrontEnd)) return 1; HAHealthCheckFrontEnd that = (HAHealthCheckFrontEnd) o; if (that.port != this.port) return 1; if (!that.acls.containsAll(this.acls)) return 1; if (!this.acls.containsAll(that.acls)) return 1; if (!that.conditions.containsAll(this.conditions)) return 1; if (!this.conditions.containsAll(that.conditions)) return 1; return 0; } HAHealthCheckFrontEnd(Integer port, List<HAACL> acls, List<HACondition> conditions); String toString(); @Override int compareTo(HAConfigurationSection o);  }### Answer:
@Test public void testEquality() { Integer backEndHealthCheckPort = 8080; HAACL anAcl = new HAACL(backEndHealthCheckPort, "/healthCheck"); HABackendServer backendServer = new HABackendServer("192.168.201.2", 44, true, "xre"); List<HABackendServer> servers = new ArrayList<HABackendServer>(); servers.add(backendServer); HAHealthCheckBackEnd healthCheckBackEnd = new HAHealthCheckBackEnd(backEndHealthCheckPort, "healthCheck", servers); HACondition haConditional = new HACondition(healthCheckBackEnd.getName(), "is_" + backEndHealthCheckPort); List<HAACL> acls = new ArrayList<HAACL>(); acls.add(anAcl); List<HACondition> conditions = new ArrayList<HACondition>(); conditions.add(haConditional); HAHealthCheckFrontEnd healthCheckFrontEnd = new HAHealthCheckFrontEnd(80, acls, conditions); HAHealthCheckFrontEnd otherCheckFrontEnd = new HAHealthCheckFrontEnd(80, acls, conditions); assertEquals(healthCheckFrontEnd.compareTo(otherCheckFrontEnd), 0); }
@Test public void testInEquality() { Integer backEndHealthCheckPort = 8080; HAACL anAcl = new HAACL(backEndHealthCheckPort, "/healthCheck"); List<HABackendServer> servers = new ArrayList<HABackendServer>(); servers.add(new HABackendServer("192.168.201.2", 44, true, "xre")); servers.add(new HABackendServer("192.168.201.3", 44, true, "xre")); servers.add(new HABackendServer("192.168.201.4", 44, true, "xre")); String backendName = "foo"; HACondition haConditional = new HACondition(backendName, "is_" + backEndHealthCheckPort); List<HAACL> acls = new ArrayList<HAACL>(); acls.add(anAcl); List<HACondition> conditions = new ArrayList<HACondition>(); conditions.add(haConditional); HAHealthCheckFrontEnd healthCheckFrontEnd = new HAHealthCheckFrontEnd(80, acls, conditions); HAHealthCheckFrontEnd otherCheckFrontEnd = new HAHealthCheckFrontEnd(81, acls, conditions); assertEquals(healthCheckFrontEnd.compareTo(otherCheckFrontEnd), 1); List<HAACL> otherAcls = new ArrayList<HAACL>(); otherCheckFrontEnd = new HAHealthCheckFrontEnd(80, otherAcls, conditions); assertEquals(healthCheckFrontEnd.compareTo(otherCheckFrontEnd), 1); }