@Test public void testEquals() { final TrafficSelector selector1 = DefaultTrafficSelector.builder() .add(Criteria.matchLambda(new OchSignal(GridType.FLEX, ChannelSpacing.CHL_100GHZ, 1, 1))) .build(); final TrafficSelector sameAsSelector1 = DefaultTrafficSelector.builder() .add(Criteria.matchLambda(new OchSignal(GridType.FLEX, ChannelSpacing.CHL_100GHZ, 1, 1))) .build(); final TrafficSelector selector2 = DefaultTrafficSelector.builder() .add(Criteria.matchLambda(new OchSignal(GridType.FLEX, ChannelSpacing.CHL_50GHZ, 1, 1))) .build(); new EqualsTester() .addEqualityGroup(selector1, sameAsSelector1) .addEqualityGroup(selector2) .testEquals(); }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof DefaultTrafficSelector) { DefaultTrafficSelector that = (DefaultTrafficSelector) obj; return Objects.equals(criteria, that.criteria); } return false; }
DefaultTrafficSelector implements TrafficSelector { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof DefaultTrafficSelector) { DefaultTrafficSelector that = (DefaultTrafficSelector) obj; return Objects.equals(criteria, that.criteria); } return false; } }
DefaultTrafficSelector implements TrafficSelector { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof DefaultTrafficSelector) { DefaultTrafficSelector that = (DefaultTrafficSelector) obj; return Objects.equals(criteria, that.criteria); } return false; } private  DefaultTrafficSelector(Collection<Criterion> criteria, Collection<Criterion> extCriteria); }
DefaultTrafficSelector implements TrafficSelector { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof DefaultTrafficSelector) { DefaultTrafficSelector that = (DefaultTrafficSelector) obj; return Objects.equals(criteria, that.criteria); } return false; } private  DefaultTrafficSelector(Collection<Criterion> criteria, Collection<Criterion> extCriteria); @Override Set<Criterion> criteria(); @Override Criterion getCriterion(Criterion.Type type); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); static TrafficSelector.Builder builder(); static TrafficSelector emptySelector(); static TrafficSelector.Builder builder(TrafficSelector selector); }
DefaultTrafficSelector implements TrafficSelector { @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj instanceof DefaultTrafficSelector) { DefaultTrafficSelector that = (DefaultTrafficSelector) obj; return Objects.equals(criteria, that.criteria); } return false; } private  DefaultTrafficSelector(Collection<Criterion> criteria, Collection<Criterion> extCriteria); @Override Set<Criterion> criteria(); @Override Criterion getCriterion(Criterion.Type type); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); static TrafficSelector.Builder builder(); static TrafficSelector emptySelector(); static TrafficSelector.Builder builder(TrafficSelector selector);  }