@Test public void testEquals() { Prefix p1 = Prefix.parse("1.1.1.0/24"); Prefix p2 = Prefix.parse("2.2.2.0/24"); StaticRoute sr1 = StaticRoute.builder().setNetwork(p1).setAdmin(1).setNextHopIp(Ip.parse("2.2.2.2")).build(); StaticRoute sr2 = StaticRoute.builder().setNetwork(p2).setAdmin(1).setNextHopIp(Ip.parse("2.2.2.2")).build(); StaticRoute sr3 = StaticRoute.builder().setNetwork(p2).setAdmin(1).setNextHopIp(Ip.parse("3.3.3.3")).build(); new EqualsTester() .addEqualityGroup(RibDelta.builder().build(), RibDelta.builder().build()) .addEqualityGroup( RibDelta.builder().add(sr1).build(), RibDelta.<StaticRoute>builder().add(sr1).build()) .addEqualityGroup(RibDelta.builder().remove(sr1, Reason.WITHDRAW).build()) .addEqualityGroup(RibDelta.builder().remove(sr1, Reason.REPLACE).build()) .addEqualityGroup(RibDelta.builder().add(sr2)) .addEqualityGroup(RibDelta.builder().add(sr3)) .addEqualityGroup(RibDelta.builder().remove(sr2, Reason.WITHDRAW).build()) .addEqualityGroup(RibDelta.builder().add(sr1).add(sr2).build()) .addEqualityGroup(RibDelta.builder().add(sr1).remove(sr2, Reason.WITHDRAW).build()) .addEqualityGroup(new Object()) .testEquals(); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof RibDelta<?>)) { return false; } RibDelta<?> ribDelta = (RibDelta<?>) o; return Objects.equals(_actions, ribDelta._actions); }
RibDelta { @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof RibDelta<?>)) { return false; } RibDelta<?> ribDelta = (RibDelta<?>) o; return Objects.equals(_actions, ribDelta._actions); } }
RibDelta { @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof RibDelta<?>)) { return false; } RibDelta<?> ribDelta = (RibDelta<?>) o; return Objects.equals(_actions, ribDelta._actions); } private  RibDelta(List<RouteAdvertisement<R>> actions); }
RibDelta { @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof RibDelta<?>)) { return false; } RibDelta<?> ribDelta = (RibDelta<?>) o; return Objects.equals(_actions, ribDelta._actions); } private  RibDelta(List<RouteAdvertisement<R>> actions); static RibDelta<R> adding(R route); static RibDelta<R> adding(Collection<R> routes); static RibDelta<R> of(RouteAdvertisement<R> action); static RibDelta<R> of(
      Collection<RouteAdvertisement<R>> actions); static RibDelta<R> merge(
      @Nullable RibDelta<R> delta1, RibDelta<R> delta2); @Nonnull Stream<Prefix> getPrefixes(); @Nonnull Stream<RouteAdvertisement<R>> getActions(); boolean isEmpty(); @Nonnull Stream<R> getRoutesStream(); static void importDeltaToBuilder(
      RibDelta.Builder<AnnotatedRoute<T>> importer, RibDelta<U> exporter, String vrfName); @Nonnull static Builder<T> builder(); @Nonnull @SuppressWarnings("unchecked") // Fully variant implementation, never stores any Ts static RibDelta<T> empty(); @Nonnull static RibDelta<AnnotatedRoute<T>> importRibDelta(
      AnnotatedRib<T> importingRib, RibDelta<AnnotatedRoute<U>> delta); @Nonnull static RibDelta<T> importRibDelta(
      AbstractRib<T> importingRib, RibDelta<U> delta); @Nonnull static RibDelta<AnnotatedRoute<T>> importRibDelta(
      AnnotatedRib<T> importingRib, RibDelta<U> delta, String vrfName); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
RibDelta { @Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof RibDelta<?>)) { return false; } RibDelta<?> ribDelta = (RibDelta<?>) o; return Objects.equals(_actions, ribDelta._actions); } private  RibDelta(List<RouteAdvertisement<R>> actions); static RibDelta<R> adding(R route); static RibDelta<R> adding(Collection<R> routes); static RibDelta<R> of(RouteAdvertisement<R> action); static RibDelta<R> of(
      Collection<RouteAdvertisement<R>> actions); static RibDelta<R> merge(
      @Nullable RibDelta<R> delta1, RibDelta<R> delta2); @Nonnull Stream<Prefix> getPrefixes(); @Nonnull Stream<RouteAdvertisement<R>> getActions(); boolean isEmpty(); @Nonnull Stream<R> getRoutesStream(); static void importDeltaToBuilder(
      RibDelta.Builder<AnnotatedRoute<T>> importer, RibDelta<U> exporter, String vrfName); @Nonnull static Builder<T> builder(); @Nonnull @SuppressWarnings("unchecked") // Fully variant implementation, never stores any Ts static RibDelta<T> empty(); @Nonnull static RibDelta<AnnotatedRoute<T>> importRibDelta(
      AnnotatedRib<T> importingRib, RibDelta<AnnotatedRoute<U>> delta); @Nonnull static RibDelta<T> importRibDelta(
      AbstractRib<T> importingRib, RibDelta<U> delta); @Nonnull static RibDelta<AnnotatedRoute<T>> importRibDelta(
      AnnotatedRib<T> importingRib, RibDelta<U> delta, String vrfName); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }