CollectionFactoryManagerImpl extends AbstractComponent implements CollectionFactoryManager { @Override public <C extends Collection> C create(Class<C> type) { return create(type, null); } CollectionFactoryManagerImpl(); static CollectionFactoryManager getInstance(); @Override CollectionFactory<C> getCollectionFactory(Class<C> collectionType); @Override MapFactory getMapFactory(Class<MAP> mapType); @Override C create(Class<C> type); @Override C create(Class<C> type, int capacity); @Override C createMap(Class<C> type); @Override C createMap(Class<C> type, int capacity);  }
@Test public void testCreate() { CollectionFactoryManager manager = getCollectionFactoryManager(); List<String> list = manager.create(List.class); Assert.assertNotNull(list); Assert.assertTrue(list.isEmpty()); ArrayList<String> arrayList = manager.create(ArrayList.class); Assert.assertNotNull(arrayList); Assert.assertTrue(arrayList.isEmpty()); Vector<String> vector = manager.create(Vector.class); Assert.assertNotNull(vector); Assert.assertTrue(vector.isEmpty()); Set<String> set = manager.create(Set.class); Assert.assertNotNull(set); Assert.assertTrue(set.isEmpty()); SortedSet<String> sortedSet = manager.create(SortedSet.class); Assert.assertNotNull(sortedSet); Assert.assertTrue(sortedSet.isEmpty()); Queue<String> queue = manager.create(Queue.class); Assert.assertNotNull(queue); Assert.assertTrue(queue.isEmpty()); BlockingQueue<String> blockingQueue = manager.create(BlockingQueue.class); Assert.assertNotNull(blockingQueue); Assert.assertTrue(blockingQueue.isEmpty()); }
@Test public void testCreateDeque() { CollectionFactoryManager manager = getCollectionFactoryManager(); Deque<String> deque = manager.create(Deque.class); Assert.assertNotNull(deque); Assert.assertTrue(deque.isEmpty()); }