@Test public void getFromPrimitiveCollectionNull() { try { ContainerUtils.getFromPrimitiveCollection(null); fail("Should throw an NullPointerException"); } catch (NullPointerException e) { assertTrue("Should throw an NullPointerException", e instanceof NullPointerException); } }
@Test public void getFromPrimitiveCollectionDouble() { Container container = ContainerUtils.getFromPrimitiveCollection(Arrays.asList(new Double[] {1d, 2d, 3d})); assertNotNull(container); assertEquals(3, container.size()); for (Object object : container.getItemIds()) { assertTrue(object instanceof Double); } }
@Test public void getFromPrimitiveCollectionInteger() { Container container = ContainerUtils.getFromPrimitiveCollection(Arrays.asList(new Integer[] {1, 2, 3})); assertNotNull(container); assertEquals(3, container.size()); for (Object object : container.getItemIds()) { assertTrue(object instanceof Integer); } }
@Test public void getFromPrimitiveCollectionString() { Container container = ContainerUtils.getFromPrimitiveCollection(Arrays.asList(new String[] {"a", "b", "c"})); assertNotNull(container); assertEquals(3, container.size()); for (Object object : container.getItemIds()) { assertTrue(object instanceof String); } }
@Test public void getFromPrimitiveCollectionEmpty() { Container container = ContainerUtils.getFromPrimitiveCollection(Arrays.asList(new String[] {})); assertNotNull(container); assertEquals(0, container.size()); }