Network { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Network other = (Network) obj; if (id == null) { if (other.id != null) { return false; } } else if (!id.equals(other.id)) { return false; } if (!name.equals(other.name)) { return false; } return true; } Network();  Network(String name, String vdc, String region); void addSubNet(SubNetwork subNet); Set<SubNetwork> cloneSubNets(); void deleteSubNet(SubNetwork subNet); void updateSubNet(SubNetwork subNet); boolean contains(SubNetwork subNet); String getNetworkName(); String getRegion(); void setNetworkName(String name); String getVdc(); void setVdc(String vdc); void setFederatedNetwork(boolean federatedNetwork); boolean getfederatedNetwork(); void setFederatedRange(String range); String getFederatedRange(); Set<SubNetwork> getSubNets(); void setSubNets(Set<SubNetwork> subNets); NetworkDto toDto(); NetworkInstance toNetworkInstance(); @Override boolean equals(Object obj); @Override int hashCode(); String toString();  }
@Test public void testPort() throws Exception { Port port = new Port("name", "networkId", "tenantId", "deviceOwner", "portId"); Port port2 = new Port("name2", "networkId", "tenantId", "deviceOwner", "2"); assertEquals(port.getName(), "name"); assertEquals(port.getNetworkId(), "networkId"); assertEquals(port.equals(port2), false); }
@Test public void testEquals() throws Exception { Network network = new Network(); network.setNetworkName(NETWORK_NAME); Network network2 = new Network(NETWORK_NAME + 2, VDC, REGION); Network network3 = new Network(NETWORK_NAME, VDC, REGION); assertEquals(network.equals(network2), false); assertEquals(network.toDto().equals(network2.toDto()), false); }
@Test public void testEqualsInstance() throws Exception { NetworkInstance network = new NetworkInstance(NETWORK_NAME, VDC, REGION); NetworkInstance network2 = new NetworkInstance(NETWORK_NAME + 2, VDC, REGION); NetworkInstance network3 = new NetworkInstance(NETWORK_NAME, VDC, REGION); assertEquals(network.equals(network2), false); assertEquals(network.equals(network3), true); }