@Test(expected = IllegalArgumentException.class) public void testReplaceMissingResource() { final Group group = new Group("group"); group.replace( Resource.create("/path", ResourceType.JS), Arrays.asList(Resource.create("", ResourceType.JS))); }
@SuppressWarnings("unchecked") @Test public void testReplaceWithEmptyCollection() { final Group group = new Group("group"); final Resource resource = Resource.create("/path", ResourceType.JS); group.addResource(resource); group.replace(resource, Collections.EMPTY_LIST); Assert.assertTrue(group.getResources().isEmpty()); }
@Test public void testReplaceWithFewResources() { final Group group = new Group("group"); final Resource resource = Resource.create("/static/*", ResourceType.JS); resource.setMinimize(false); group.addResource(resource); group.replace( resource, Arrays.asList( Resource.create("/static/one.js", ResourceType.JS), Resource.create("/static/two.js", ResourceType.JS))); Assert.assertEquals(2, group.getResources().size()); Assert.assertEquals(resource.isMinimize(), group.getResources().get(0).isMinimize()); }