Counter { public synchronized long decrease() { return --value; } Counter(int startValue); synchronized long decrease(); synchronized long decrease(long amount); synchronized long increase(); synchronized long increase(long amount); synchronized void clear(); synchronized long getValue(); synchronized void setValue(long newValue);  }
@Test public void testDecrease() throws Exception { Counter c = new Counter(15); assertEquals(14, c.decrease()); }
@Test public void testDecreaseAmount() throws Exception { Counter c = new Counter(15); assertEquals(5, c.decrease(10)); }