RemoteControlledSampler implements Sampler { @Override public boolean equals(Object sampler) { if (this == sampler) { return true; } if (sampler instanceof RemoteControlledSampler) { RemoteControlledSampler remoteSampler = ((RemoteControlledSampler) sampler); return this.sampler.equals(remoteSampler.sampler); } return false; } private  RemoteControlledSampler(Builder builder); @Override SamplingStatus sample(String operation, long id); @Override boolean equals(Object sampler); @Override void close(); static final String TYPE; }
@Test public void testEquals() { RemoteControlledSampler i2 = new RemoteControlledSampler.Builder(SERVICE_NAME) .withSamplingManager(samplingManager) .withInitialSampler(mock(Sampler.class)) .withMetrics(metrics) .build(); assertEquals(undertest, undertest); assertNotEquals(undertest, initialSampler); assertNotEquals(undertest, i2); assertNotEquals(i2, undertest); }