### Question:
InstancePool { public HazelcastInstance get() { return get(position.getAndIncrement() % size()); } InstancePool(int size, Supplier<HazelcastInstance> instanceSupplier); int size(); HazelcastInstance get(); void prestartAll(); void prestart(int numInstances);  }### Answer:
@Test public void testGet() { final int size = 4; final Supplier<HazelcastInstance> supplier = Classes.cast(mock(Supplier.class)); when(supplier.get()).thenAnswer(invocation -> mock(HazelcastInstance.class)); final InstancePool pool = new InstancePool(size, supplier); final List<HazelcastInstance> instances = new ArrayList<>(size * 2); for (int i = 0; i < size * 2; i++) { final HazelcastInstance instance = pool.get(); assertNotNull(instance); instances.add(instance); } verify(supplier, times(4)).get(); final Set<HazelcastInstance> set = new HashSet<>(instances); assertEquals(size, set.size()); }