### Question:
CounterMXBeanImpl extends AbstractSimonMXBeanImpl implements CounterMXBean { @Override public CounterSample sampleIncrement(String key) { return new CounterSample(counter.sampleIncrement(key)); } CounterMXBeanImpl(Counter counter); @Override final void increase(); @Override final void decrease(); @Override final void increase(long inc); @Override final void decrease(long dec); @Override long getMaxTimestamp(); @Override long getMax(); @Override long getMinTimestamp(); @Override long getMin(); @Override long getCounter(); @Override final void set(long val); @Override long getIncrementSum(); @Override long getDecrementSum(); @Override final CounterSample sample(); @Override CounterSample sampleIncrement(String key); @Override final String getType(); @Override boolean stopIncrementalSampling(String key);  }### Answer:
@Test public void testSampleIncrement() { String key = "key"; org.javasimon.CounterSample sample = new CounterSample(); sample.setCounter(1); when(counter.sampleIncrement(key)).thenReturn(sample); CounterSample actualSample = counterMXBean.sampleIncrement(key); Assert.assertEquals(actualSample.getCounter(), 1); verify(counter).sampleIncrement(key); }