@Test public void testIsWithdrawn() { RouteAdvertisement.Builder<StaticRoute> raBuilder = RouteAdvertisement.<StaticRoute>builder() .setRoute( StaticRoute.builder() .setAdministrativeCost(1) .setNetwork(Prefix.parse("1.1.1.0/24")) .setNextHopIp(Ip.parse("2.2.2.2")) .build()); assertThat(raBuilder.setReason(Reason.ADD).build().isWithdrawn(), equalTo(false)); assertThat(raBuilder.setReason(Reason.REPLACE).build().isWithdrawn(), equalTo(true)); assertThat(raBuilder.setReason(Reason.WITHDRAW).build().isWithdrawn(), equalTo(true)); }
public boolean isWithdrawn() { switch (_reason) { case WITHDRAW: case REPLACE: return true; case ADD: return false; default: throw new BatfishException( String.format("Unrecognized RouteAdvertisement reason: %s", _reason)); } }
RouteAdvertisement { public boolean isWithdrawn() { switch (_reason) { case WITHDRAW: case REPLACE: return true; case ADD: return false; default: throw new BatfishException( String.format("Unrecognized RouteAdvertisement reason: %s", _reason)); } } }
RouteAdvertisement { public boolean isWithdrawn() { switch (_reason) { case WITHDRAW: case REPLACE: return true; case ADD: return false; default: throw new BatfishException( String.format("Unrecognized RouteAdvertisement reason: %s", _reason)); } } @VisibleForTesting  RouteAdvertisement(T route, Reason reason);  RouteAdvertisement(T route); }
RouteAdvertisement { public boolean isWithdrawn() { switch (_reason) { case WITHDRAW: case REPLACE: return true; case ADD: return false; default: throw new BatfishException( String.format("Unrecognized RouteAdvertisement reason: %s", _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 { public boolean isWithdrawn() { switch (_reason) { case WITHDRAW: case REPLACE: return true; case ADD: return false; default: throw new BatfishException( String.format("Unrecognized RouteAdvertisement reason: %s", _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();  }