UcteNodeCode implements Comparable<UcteNodeCode> { @Override public boolean equals(Object obj) { if (obj instanceof UcteNodeCode) { UcteNodeCode other = (UcteNodeCode) obj; return ucteCountryCode == other.ucteCountryCode && geographicalSpot.equals(other.geographicalSpot) && voltageLevelCode == other.voltageLevelCode && Objects.equals(busbar, other.busbar); } return false; } UcteNodeCode(UcteCountryCode ucteCountryCode, String geographicalSpot, UcteVoltageLevelCode voltageLevelCode, Character busbar); UcteCountryCode getUcteCountryCode(); void setUcteCountryCode(UcteCountryCode ucteCountryCode); String getGeographicalSpot(); void setGeographicalSpot(String geographicalSpot); UcteVoltageLevelCode getVoltageLevelCode(); void setVoltageLevelCode(UcteVoltageLevelCode voltageLevelCode); Character getBusbar(); void setBusbar(Character busbar); static Optional<UcteNodeCode> parseUcteNodeCode(String id); static boolean isUcteNodeId(String id); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); @Override int compareTo(UcteNodeCode ucteNodeCode);  }
@Test public void testEquals() { UcteNodeCode node1 = new UcteNodeCode(UcteCountryCode.FR, "SUBST", UcteVoltageLevelCode.VL_380, '1'); UcteNodeCode node2 = new UcteNodeCode(UcteCountryCode.FR, "SUBST", UcteVoltageLevelCode.VL_380, '1'); new EqualsTester() .addEqualityGroup(node1, node2) .testEquals(); node2.setBusbar(null); new EqualsTester() .addEqualityGroup(node1) .addEqualityGroup(node2) .testEquals(); }