ResourceHostInfoModel extends HostInfoModel implements ResourceHostInfo { @Override public boolean equals( final Object o ) { if ( this == o ) { return true; } if ( !( o instanceof ResourceHostInfoModel ) ) { return false; } final ResourceHostInfoModel that = ( ResourceHostInfoModel ) o; if ( id != null ? !id.equals( that.id ) : that.id != null ) { return false; } return true; } ResourceHostInfoModel( final ResourceHostInfo resourceHostInfo ); long getDateCreated(); void setDateCreated( final long dateCreated ); @Override String getAddress(); @Override String getId(); @Override String getHostname(); @Override @JsonIgnore InstanceType getInstanceType(); @JsonIgnore Set<Alert> getAlerts(); @JsonIgnore @Override Set<ContainerHostInfo> getContainers(); @Override String toString(); @Override int compareTo( final HostInfo o ); @Override boolean equals( final Object o ); @Override int hashCode();  }
@Test public void testEqualsHashCode() throws Exception { ResourceHostInfo resourceHostInfo2 = JsonUtil.fromJson( INFO_JSON, ResourceHostInfoModel.class ); assertEquals( resourceHostInfo, resourceHostInfo2 ); assertFalse( resourceHostInfo.equals( new Object() ) ); ResourceHostInfo resourceHostInfo3 = JsonUtil.fromJson( INFO2_JSON, ResourceHostInfoModel.class ); assertNotEquals( resourceHostInfo, resourceHostInfo3 ); Map<ResourceHostInfo, ResourceHostInfo> map = Maps.newHashMap(); map.put( resourceHostInfo2, resourceHostInfo2 ); assertEquals( resourceHostInfo2, map.get( resourceHostInfo ) ); }