@Test public void testEquals() { Aggregate emptyCloud = new Aggregate("cloud", AggregateType.CLOUD); Aggregate emptyCloudCloned = BatfishObjectMapper.clone(emptyCloud, Aggregate.class); Aggregate diffName = new Aggregate("cloud2", AggregateType.CLOUD); Aggregate diffType = BatfishObjectMapper.clone(emptyCloud, Aggregate.class); diffType.setType(AggregateType.REGION); Aggregate cloudWithStuff = BatfishObjectMapper.clone(emptyCloud, Aggregate.class); cloudWithStuff.setContents(ImmutableSet.of("stuff")); new EqualsTester() .addEqualityGroup(emptyCloud, emptyCloudCloned) .addEqualityGroup(diffName) .addEqualityGroup(diffType) .addEqualityGroup(cloudWithStuff) .testEquals(); }
@Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } else if (!(o instanceof Aggregate)) { return false; } Aggregate a = (Aggregate) o; return _type == a._type && _name.equals(a._name) && _contents.equals(a._contents) && Objects.equals(getId(), a.getId()); }
Aggregate extends BfObject { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } else if (!(o instanceof Aggregate)) { return false; } Aggregate a = (Aggregate) o; return _type == a._type && _name.equals(a._name) && _contents.equals(a._contents) && Objects.equals(getId(), a.getId()); } }
Aggregate extends BfObject { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } else if (!(o instanceof Aggregate)) { return false; } Aggregate a = (Aggregate) o; return _type == a._type && _name.equals(a._name) && _contents.equals(a._contents) && Objects.equals(getId(), a.getId()); } Aggregate(String name, AggregateType type); }
Aggregate extends BfObject { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } else if (!(o instanceof Aggregate)) { return false; } Aggregate a = (Aggregate) o; return _type == a._type && _name.equals(a._name) && _contents.equals(a._contents) && Objects.equals(getId(), a.getId()); } Aggregate(String name, AggregateType type); @JsonProperty(PROP_CONTENTS) Set<String> getContents(); @JsonProperty(PROP_NAME) String getName(); @JsonProperty(PROP_TYPE) AggregateType getType(); void setContents(Set<String> contents); void setType(AggregateType type); @Override boolean equals(@Nullable Object o); @Override int hashCode(); }
Aggregate extends BfObject { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } else if (!(o instanceof Aggregate)) { return false; } Aggregate a = (Aggregate) o; return _type == a._type && _name.equals(a._name) && _contents.equals(a._contents) && Objects.equals(getId(), a.getId()); } Aggregate(String name, AggregateType type); @JsonProperty(PROP_CONTENTS) Set<String> getContents(); @JsonProperty(PROP_NAME) String getName(); @JsonProperty(PROP_TYPE) AggregateType getType(); void setContents(Set<String> contents); void setType(AggregateType type); @Override boolean equals(@Nullable Object o); @Override int hashCode();  }