MonitorRequest { @Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof MonitorRequest)) { return false; } MonitorRequest that = (MonitorRequest) other; return Objects.equals(columns, that.getColumns()) && Objects.equals(select, that.getSelect()); } MonitorRequest();  MonitorRequest(List<String> columns);  MonitorRequest(MonitorSelect select);  MonitorRequest(List<String> columns, MonitorSelect select); List<String> getColumns(); MonitorSelect getSelect(); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString();  }
@Test public void testEquals() { List<String> columns1 = ImmutableList.of("column1", "column2"); List<String> columns2 = Stream.of("column1", "column2").collect(Collectors.toList()); MonitorSelect monitorSelect1 = new MonitorSelect().setInitial(true).setInsert(false); MonitorSelect monitorSelect2 = new MonitorSelect(true, false, null, null); new EqualsTester() .addEqualityGroup(new MonitorRequest(), new MonitorRequest(null, null)) .addEqualityGroup(new MonitorRequest(columns1), new MonitorRequest(columns2, null)) .addEqualityGroup(new MonitorRequest(columns1, monitorSelect1), new MonitorRequest(columns2, monitorSelect2)) .testEquals(); }