SquirrelWebObject implements Serializable { @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof SquirrelWebObject)) return false; SquirrelWebObject that = (SquirrelWebObject) o; if (Math.abs(getRuntimeInSeconds() - that.getRuntimeInSeconds()) >= 15) return false; return getCountOfCrawledURIs() == that.getCountOfCrawledURIs() && getCountOfWorker() == that.getCountOfWorker() && getCountOfDeadWorker() == that.getCountOfDeadWorker() && Objects.equals(pendingURIs, that.pendingURIs) && Objects.equals(IPMapPendingURis, that.IPMapPendingURis) && Objects.equals(nextCrawledURIs, that.nextCrawledURIs) && Objects.equals(graph, that.graph); } SquirrelWebObject(); List<String> getPendingURIs(); int getCountOfPendingURIs(); List<String> getNextCrawledURIs(); Map<String, List<String>> getIpStringListMap(); @SuppressWarnings("all") int getCountOfWorker(); @SuppressWarnings("all") int getCountOfDeadWorker(); @SuppressWarnings("all") long getRuntimeInSeconds(); @SuppressWarnings("all") int getCountOfCrawledURIs(); @SuppressWarnings("unused") String getWriteTime(); @SuppressWarnings("unused") String getReadTime(); VisualisationGraph getGraph(); @Override String toString(); void setPendingURIs(List<String> pendingURIs); void setIPMapPendingURis(Map<String, List<String>> IPMapPendingURis); void setCountOfWorker(int countOfWorker); void setCountOfDeadWorker(int countOfDeadWorker); void setCountOfCrawledURIs(int countOfCrawledURIs); void setNextCrawledURIs(List<String> nextCrawledURIs); void setRuntimeInSeconds(long runtimeInSeconds); void setGraph(VisualisationGraph graph); @Override boolean equals(Object o); @Override int hashCode(); @SuppressWarnings("all") @Deprecated byte[] convertToByteStream();  }
@Test public void equals() { SquirrelWebObject o1 = new SquirrelWebObject(); SquirrelWebObject o2 = new SquirrelWebObject(); assertTrue("2 new SquirrelWebObjects should be equal...", o1.equals(o2)); ArrayList<String> pendingURIs = new ArrayList<>(); pendingURIs.add("https: pendingURIs.add("https: try { o2.setPendingURIs(pendingURIs); o2.setIPMapPendingURis(Collections.singletonMap("1.1.1.1", pendingURIs)); } catch (IllegalAccessException e) { e.printStackTrace(); } assertFalse("One of them got pending URIs --> not equal any more", o1.equals(o2)); try { o1.setPendingURIs((List<String>) pendingURIs.clone()); o1.setIPMapPendingURis(Collections.singletonMap("1.1.1.1", pendingURIs)); } catch (IllegalAccessException e) { e.printStackTrace(); } assertTrue("Now the other SquirrelWebObjects got the same list --> equal again!", o1.equals(o2)); o1.setGraph(new VisualisationGraph()); o2.setGraph(new VisualisationGraph()); assertTrue("SquirrelWebObjects with a similar graph should be the same", o1.equals(o2)); }