Suppliers { public static Supplier<Integer> incrementing() { return incrementing(0); } private  Suppliers(); static Supplier<Integer> incrementing(); static Supplier<Integer> incrementing(int initialValue);  }
@Test public void testIncrementing() throws Exception { Supplier<Integer> supplier = Suppliers.incrementing(); assertEquals(supplier.get(), Integer.valueOf(0)); assertEquals(supplier.get(), Integer.valueOf(1)); assertEquals(supplier.get(), Integer.valueOf(2)); }
@Test public void testIncrementingFrom() throws Exception { Supplier<Integer> supplier = Suppliers.incrementing(9876); assertEquals(supplier.get(), Integer.valueOf(9876)); assertEquals(supplier.get(), Integer.valueOf(9877)); assertEquals(supplier.get(), Integer.valueOf(9878)); }