@Test public void testEquals() { ConnectedRoute cr1 = new ConnectedRoute(Prefix.parse("1.1.1.0/24"), "Ethernet0"); ConnectedRoute cr2 = new ConnectedRoute(Prefix.parse("1.1.2.0/24"), "Ethernet0"); new EqualsTester() .addEqualityGroup(new RouteAdvertisement<>(cr1), new RouteAdvertisement<>(cr1)) .addEqualityGroup(new RouteAdvertisement<>(cr2)) .addEqualityGroup(new RouteAdvertisement<>(cr2, Reason.REPLACE)) .addEqualityGroup(new RouteAdvertisement<>(cr2, Reason.WITHDRAW)) .addEqualityGroup(new Object()) .testEquals(); }
@Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (!(o instanceof RouteAdvertisement)) { return false; } RouteAdvertisement<?> that = (RouteAdvertisement<?>) o; return (_hashCode == that._hashCode || _hashCode == 0 || that._hashCode == 0) && _route.equals(that._route) && _reason == that._reason; }
RouteAdvertisement { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (!(o instanceof RouteAdvertisement)) { return false; } RouteAdvertisement<?> that = (RouteAdvertisement<?>) o; return (_hashCode == that._hashCode || _hashCode == 0 || that._hashCode == 0) && _route.equals(that._route) && _reason == that._reason; } }
RouteAdvertisement { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (!(o instanceof RouteAdvertisement)) { return false; } RouteAdvertisement<?> that = (RouteAdvertisement<?>) o; return (_hashCode == that._hashCode || _hashCode == 0 || that._hashCode == 0) && _route.equals(that._route) && _reason == that._reason; } @VisibleForTesting  RouteAdvertisement(T route, Reason reason);  RouteAdvertisement(T route); }
RouteAdvertisement { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (!(o instanceof RouteAdvertisement)) { return false; } RouteAdvertisement<?> that = (RouteAdvertisement<?>) o; return (_hashCode == that._hashCode || _hashCode == 0 || that._hashCode == 0) && _route.equals(that._route) && _reason == that._reason; } @VisibleForTesting  RouteAdvertisement(T route, Reason reason);  RouteAdvertisement(T route); static RouteAdvertisement<T> adding(T route); static RouteAdvertisement<T> replacing(T route); static RouteAdvertisement<T> withdrawing(T route); @Nonnull T getRoute(); @Nonnull Reason getReason(); boolean isWithdrawn(); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override String toString(); @Nonnull static Builder<T> builder(); @Nonnull Builder<T> toBuilder(); RouteAdvertisement<T> sanitizeForExport(); }
RouteAdvertisement { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (!(o instanceof RouteAdvertisement)) { return false; } RouteAdvertisement<?> that = (RouteAdvertisement<?>) o; return (_hashCode == that._hashCode || _hashCode == 0 || that._hashCode == 0) && _route.equals(that._route) && _reason == that._reason; } @VisibleForTesting  RouteAdvertisement(T route, Reason reason);  RouteAdvertisement(T route); static RouteAdvertisement<T> adding(T route); static RouteAdvertisement<T> replacing(T route); static RouteAdvertisement<T> withdrawing(T route); @Nonnull T getRoute(); @Nonnull Reason getReason(); boolean isWithdrawn(); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override String toString(); @Nonnull static Builder<T> builder(); @Nonnull Builder<T> toBuilder(); RouteAdvertisement<T> sanitizeForExport();  }