@Test public void testEquals() { TraceElement traceElement1 = TraceElement.of("1"); TraceElement traceElement2 = TraceElement.of("2"); List<TraceTree> children1 = ImmutableList.of(); List<TraceTree> children2 = ImmutableList.of(new TraceTree(null, ImmutableList.of())); new EqualsTester() .addEqualityGroup( new TraceTree(traceElement1, children1), new TraceTree(traceElement1, children1)) .addEqualityGroup(new TraceTree(traceElement2, children1)) .addEqualityGroup(new TraceTree(traceElement1, children2)) .testEquals(); }
@Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (!(o instanceof TraceTree)) { return false; } TraceTree other = (TraceTree) o; return Objects.equals(_traceElement, other._traceElement) && _children.equals(other._children); }
TraceTree { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (!(o instanceof TraceTree)) { return false; } TraceTree other = (TraceTree) o; return Objects.equals(_traceElement, other._traceElement) && _children.equals(other._children); } }
TraceTree { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (!(o instanceof TraceTree)) { return false; } TraceTree other = (TraceTree) o; return Objects.equals(_traceElement, other._traceElement) && _children.equals(other._children); } TraceTree(TraceElement traceElement, List<TraceTree> children); }
TraceTree { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (!(o instanceof TraceTree)) { return false; } TraceTree other = (TraceTree) o; return Objects.equals(_traceElement, other._traceElement) && _children.equals(other._children); } TraceTree(TraceElement traceElement, List<TraceTree> children); @JsonProperty(PROP_CHILDREN) @Nonnull List<TraceTree> getChildren(); @JsonProperty(PROP_TRACE_ELEMENT) @Nullable TraceElement getTraceElement(); @Override boolean equals(@Nullable Object o); @Override int hashCode(); }
TraceTree { @Override public boolean equals(@Nullable Object o) { if (this == o) { return true; } if (!(o instanceof TraceTree)) { return false; } TraceTree other = (TraceTree) o; return Objects.equals(_traceElement, other._traceElement) && _children.equals(other._children); } TraceTree(TraceElement traceElement, List<TraceTree> children); @JsonProperty(PROP_CHILDREN) @Nonnull List<TraceTree> getChildren(); @JsonProperty(PROP_TRACE_ELEMENT) @Nullable TraceElement getTraceElement(); @Override boolean equals(@Nullable Object o); @Override int hashCode();  }