MonitorRequests { @Override public boolean equals(Object other) { if (this == other) { return true; } if (!(other instanceof MonitorRequests)) { return false; } MonitorRequests that = (MonitorRequests) other; return Objects.equals(monitorRequests, that.getMonitorRequests()); } MonitorRequests(Map<String, MonitorRequest> monitorRequests); Map<String, MonitorRequest> getMonitorRequests(); @Override boolean equals(Object other); @Override int hashCode(); @Override String toString();  }
@Test public void testEquals() { String tableName1 = "table1"; String tableName2 = "table2"; 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); MonitorRequest monitorRequest11 = new MonitorRequest(); MonitorRequest monitorRequest12 = new MonitorRequest(null, null); MonitorRequest monitorRequest21 = new MonitorRequest(columns1, monitorSelect1); MonitorRequest monitorRequest22 = new MonitorRequest(columns2, monitorSelect2); MonitorRequests monitorRequests11 = new MonitorRequests( ImmutableMap.of(tableName1, monitorRequest11, tableName2, monitorRequest21)); Map<String, MonitorRequest> monitorRequestMap = new HashMap<>(); monitorRequestMap.put(tableName1, monitorRequest12); monitorRequestMap.put(tableName2, monitorRequest22); MonitorRequests monitorRequests12 = new MonitorRequests(monitorRequestMap); new EqualsTester() .addEqualityGroup(monitorRequests11, monitorRequests12) .testEquals(); }