@Test public void testEquals() { DiscreteResource resource1 = Resources.discrete(D1, P1, VLAN1).resource(); DiscreteResource sameAsResource1 = Resources.discrete(D1, P1, VLAN1).resource(); DiscreteResource resource2 = Resources.discrete(D2, P1, VLAN1).resource(); new EqualsTester() .addEqualityGroup(resource1, sameAsResource1) .addEqualityGroup(resource2) .testEquals(); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final DiscreteResource other = (DiscreteResource) obj; return Objects.equals(this.id, other.id); }
DiscreteResource implements Resource { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final DiscreteResource other = (DiscreteResource) obj; return Objects.equals(this.id, other.id); } }
DiscreteResource implements Resource { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final DiscreteResource other = (DiscreteResource) obj; return Objects.equals(this.id, other.id); } DiscreteResource(DiscreteResourceId id);   DiscreteResource(); }
DiscreteResource implements Resource { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final DiscreteResource other = (DiscreteResource) obj; return Objects.equals(this.id, other.id); } DiscreteResource(DiscreteResourceId id);   DiscreteResource(); @Override DiscreteResourceId id(); @Override String simpleTypeName(); @Override boolean isTypeOf(Class<?> type); @Override boolean isSubTypeOf(Class<?> ancestor); @Override Optional<T> valueAs(Class<T> type); @Override DiscreteResource child(Object child); @Override ContinuousResource child(Class<?> child, double value); @Override Optional<DiscreteResource> parent(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); }
DiscreteResource implements Resource { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final DiscreteResource other = (DiscreteResource) obj; return Objects.equals(this.id, other.id); } DiscreteResource(DiscreteResourceId id);   DiscreteResource(); @Override DiscreteResourceId id(); @Override String simpleTypeName(); @Override boolean isTypeOf(Class<?> type); @Override boolean isSubTypeOf(Class<?> ancestor); @Override Optional<T> valueAs(Class<T> type); @Override DiscreteResource child(Object child); @Override ContinuousResource child(Class<?> child, double value); @Override Optional<DiscreteResource> parent(); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString();  }