@Test public void testEquals() { ConnectPoint connectPoint1 = NetTestTools.connectPoint("sw1", 1); ConnectPoint connectPoint2 = NetTestTools.connectPoint("sw2", 2); ConnectPoint connectPoint3 = NetTestTools.connectPoint("sw3", 3); DefaultLinkDescription link1 = new DefaultLinkDescription(connectPoint1, connectPoint2, Link.Type.DIRECT); DefaultLinkDescription sameAsLink1 = new DefaultLinkDescription(connectPoint1, connectPoint2, Link.Type.DIRECT); DefaultLinkDescription link2 = new DefaultLinkDescription(connectPoint1, connectPoint2, Link.Type.INDIRECT); DefaultLinkDescription link3 = new DefaultLinkDescription(connectPoint1, connectPoint3, Link.Type.DIRECT); DefaultLinkDescription link4 = new DefaultLinkDescription(connectPoint2, connectPoint3, Link.Type.DIRECT); DefaultLinkDescription link5 = new DefaultLinkDescription(connectPoint1, connectPoint2, Link.Type.DIRECT, false); DefaultLinkDescription link6 = new DefaultLinkDescription(connectPoint2, connectPoint3, Link.Type.DIRECT, DA); new EqualsTester() .addEqualityGroup(link1, sameAsLink1) .addEqualityGroup(link2) .addEqualityGroup(link3) .addEqualityGroup(link4) .addEqualityGroup(link5) .addEqualityGroup(link6) .testEquals(); }
@Override public boolean equals(Object object) { if (object != null && getClass() == object.getClass()) { if (!super.equals(object)) { return false; } DefaultLinkDescription that = (DefaultLinkDescription) object; return Objects.equal(this.src, that.src) && Objects.equal(this.dst, that.dst) && Objects.equal(this.type, that.type) && Objects.equal(this.isExpected, that.isExpected); } return false; }
DefaultLinkDescription extends AbstractDescription implements LinkDescription { @Override public boolean equals(Object object) { if (object != null && getClass() == object.getClass()) { if (!super.equals(object)) { return false; } DefaultLinkDescription that = (DefaultLinkDescription) object; return Objects.equal(this.src, that.src) && Objects.equal(this.dst, that.dst) && Objects.equal(this.type, that.type) && Objects.equal(this.isExpected, that.isExpected); } return false; } }
DefaultLinkDescription extends AbstractDescription implements LinkDescription { @Override public boolean equals(Object object) { if (object != null && getClass() == object.getClass()) { if (!super.equals(object)) { return false; } DefaultLinkDescription that = (DefaultLinkDescription) object; return Objects.equal(this.src, that.src) && Objects.equal(this.dst, that.dst) && Objects.equal(this.type, that.type) && Objects.equal(this.isExpected, that.isExpected); } return false; } DefaultLinkDescription(ConnectPoint src, ConnectPoint dst,
                                  Link.Type type,
                                  boolean isExpected,
                                  SparseAnnotations... annotations);  DefaultLinkDescription(ConnectPoint src, ConnectPoint dst,
                                  Link.Type type,
                                  SparseAnnotations... annotations); }
DefaultLinkDescription extends AbstractDescription implements LinkDescription { @Override public boolean equals(Object object) { if (object != null && getClass() == object.getClass()) { if (!super.equals(object)) { return false; } DefaultLinkDescription that = (DefaultLinkDescription) object; return Objects.equal(this.src, that.src) && Objects.equal(this.dst, that.dst) && Objects.equal(this.type, that.type) && Objects.equal(this.isExpected, that.isExpected); } return false; } DefaultLinkDescription(ConnectPoint src, ConnectPoint dst,
                                  Link.Type type,
                                  boolean isExpected,
                                  SparseAnnotations... annotations);  DefaultLinkDescription(ConnectPoint src, ConnectPoint dst,
                                  Link.Type type,
                                  SparseAnnotations... annotations); @Override ConnectPoint src(); @Override ConnectPoint dst(); @Override Link.Type type(); @Override boolean isExpected(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object object); }
DefaultLinkDescription extends AbstractDescription implements LinkDescription { @Override public boolean equals(Object object) { if (object != null && getClass() == object.getClass()) { if (!super.equals(object)) { return false; } DefaultLinkDescription that = (DefaultLinkDescription) object; return Objects.equal(this.src, that.src) && Objects.equal(this.dst, that.dst) && Objects.equal(this.type, that.type) && Objects.equal(this.isExpected, that.isExpected); } return false; } DefaultLinkDescription(ConnectPoint src, ConnectPoint dst,
                                  Link.Type type,
                                  boolean isExpected,
                                  SparseAnnotations... annotations);  DefaultLinkDescription(ConnectPoint src, ConnectPoint dst,
                                  Link.Type type,
                                  SparseAnnotations... annotations); @Override ConnectPoint src(); @Override ConnectPoint dst(); @Override Link.Type type(); @Override boolean isExpected(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object object); static final boolean EXPECTED; static final boolean NOT_EXPECTED; }