AccumulatorRequest { @Override public boolean equals(Object other) { if (other == null) return false; if (!(other instanceof AccumulatorRequest)) return false; if (!((AccumulatorRequest)other).getName().equals(this.getName())) return false; return true; } AccumulatorRequest(String name, Class<?> clazz); String getName(); Class<?> getClazz(); @Override boolean equals(Object other); @Override int hashCode();  }
@Test public void testEquality() { AccumulatorRequest request1; AccumulatorRequest request2; request1 = new AccumulatorRequest("hello", Long.class); request2 = new AccumulatorRequest("hello", Long.class); assertTrue(request1.equals(request2)); request1 = new AccumulatorRequest("hello", Long.class); request2 = new AccumulatorRequest("hello", Long.class); assertTrue(request1.equals(request2)); request1 = new AccumulatorRequest("hello", Long.class); request2 = new AccumulatorRequest("hello", Double.class); assertTrue(request1.equals(request2)); request1 = new AccumulatorRequest("hello", Long.class); request2 = new AccumulatorRequest("world", Long.class); assertFalse(request1.equals(request2)); }