@Test public void testEquals() { If ifExpr = new If(new PacketMatchExpr(FalseExpr.INSTANCE), ImmutableList.of()); new EqualsTester() .addEqualityGroup( ifExpr, ifExpr, new If(new PacketMatchExpr(FalseExpr.INSTANCE), ImmutableList.of())) .addEqualityGroup(new If(new PacketMatchExpr(TrueExpr.INSTANCE), ImmutableList.of())) .addEqualityGroup( new If( new PacketMatchExpr(FalseExpr.INSTANCE), ImmutableList.of(new Return(Drop.instance())))) .addEqualityGroup(new Object()) .testEquals(); }
@Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } If anIf = (If) o; return Objects.equals(getMatchCondition(), anIf.getMatchCondition()) && Objects.equals(getTrueStatements(), anIf.getTrueStatements()); }
If implements Statement { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } If anIf = (If) o; return Objects.equals(getMatchCondition(), anIf.getMatchCondition()) && Objects.equals(getTrueStatements(), anIf.getTrueStatements()); } }
If implements Statement { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } If anIf = (If) o; return Objects.equals(getMatchCondition(), anIf.getMatchCondition()) && Objects.equals(getTrueStatements(), anIf.getTrueStatements()); } If(BoolExpr matchCondition, List<Statement> trueStatements); }
If implements Statement { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } If anIf = (If) o; return Objects.equals(getMatchCondition(), anIf.getMatchCondition()) && Objects.equals(getTrueStatements(), anIf.getTrueStatements()); } If(BoolExpr matchCondition, List<Statement> trueStatements); @Nonnull @JsonProperty(PROP_ACTIONS) List<Statement> getTrueStatements(); @Nonnull @JsonProperty(PROP_TRUE_STATEMENTS) BoolExpr getMatchCondition(); @Override T accept(StatementVisitor<T> visitor); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override String toString(); }
If implements Statement { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } If anIf = (If) o; return Objects.equals(getMatchCondition(), anIf.getMatchCondition()) && Objects.equals(getTrueStatements(), anIf.getTrueStatements()); } If(BoolExpr matchCondition, List<Statement> trueStatements); @Nonnull @JsonProperty(PROP_ACTIONS) List<Statement> getTrueStatements(); @Nonnull @JsonProperty(PROP_TRUE_STATEMENTS) BoolExpr getMatchCondition(); @Override T accept(StatementVisitor<T> visitor); @Override boolean equals(@Nullable Object o); @Override int hashCode(); @Override String toString();  }