@Test public void testEquals() { String name1 = "Firewall"; String description1 = "Firewall service function"; Map<PortPairId, Integer> portPairLoadMap1 = new ConcurrentHashMap<>(); PortPairId portPairId1 = PortPairId.of("a4444444-4a56-2a6e-cd3a-9dee4e2ec345"); portPairLoadMap1.put(portPairId1, Integer.valueOf(2)); ServiceFunctionGroup sfg1 = new ServiceFunctionGroup(name1, description1, portPairLoadMap1); ServiceFunctionGroup sameAsSfg1 = new ServiceFunctionGroup(name1, description1, portPairLoadMap1); String name2 = "Dpi"; String description2 = "Dpi service function"; Map<PortPairId, Integer> portPairLoadMap2 = new ConcurrentHashMap<>(); PortPairId portPairId2 = PortPairId.of("b6666666-4a56-2a6e-cd3a-9dee4e2ec345"); portPairLoadMap2.put(portPairId2, Integer.valueOf(3)); ServiceFunctionGroup sfg2 = new ServiceFunctionGroup(name2, description2, portPairLoadMap2); new EqualsTester().addEqualityGroup(sfg1, sameAsSfg1).addEqualityGroup(sfg2).testEquals(); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof ServiceFunctionGroup) { ServiceFunctionGroup that = (ServiceFunctionGroup) obj; return Objects.equals(name, that.name()) && Objects.equals(description, that.description()) && Objects.equals(portPairLoadMap, that.portPairLoadMap()); } return false; }
ServiceFunctionGroup { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof ServiceFunctionGroup) { ServiceFunctionGroup that = (ServiceFunctionGroup) obj; return Objects.equals(name, that.name()) && Objects.equals(description, that.description()) && Objects.equals(portPairLoadMap, that.portPairLoadMap()); } return false; } }
ServiceFunctionGroup { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof ServiceFunctionGroup) { ServiceFunctionGroup that = (ServiceFunctionGroup) obj; return Objects.equals(name, that.name()) && Objects.equals(description, that.description()) && Objects.equals(portPairLoadMap, that.portPairLoadMap()); } return false; } ServiceFunctionGroup(String name, String description,
                                Map<PortPairId, Integer> portPairLoadMap); }
ServiceFunctionGroup { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof ServiceFunctionGroup) { ServiceFunctionGroup that = (ServiceFunctionGroup) obj; return Objects.equals(name, that.name()) && Objects.equals(description, that.description()) && Objects.equals(portPairLoadMap, that.portPairLoadMap()); } return false; } ServiceFunctionGroup(String name, String description,
                                Map<PortPairId, Integer> portPairLoadMap); String name(); String description(); Map<PortPairId, Integer> portPairLoadMap(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); }
ServiceFunctionGroup { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof ServiceFunctionGroup) { ServiceFunctionGroup that = (ServiceFunctionGroup) obj; return Objects.equals(name, that.name()) && Objects.equals(description, that.description()) && Objects.equals(portPairLoadMap, that.portPairLoadMap()); } return false; } ServiceFunctionGroup(String name, String description,
                                Map<PortPairId, Integer> portPairLoadMap); String name(); String description(); Map<PortPairId, Integer> portPairLoadMap(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }