Counter { public synchronized long increase() { 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 testIncrease() throws Exception { Counter c = new Counter(15); assertEquals(16, c.increase()); }
@Test public void testIncreaseAmount() throws Exception { Counter c = new Counter(15); assertEquals(25, c.increase(10)); }