AssetGroupManager { public void addAsset(Asset asset) { AssetGroup group = _groups.get(asset.getGroup() + "-" + asset.getType()); if (group == null) { throw new IllegalArgumentException("AssetGroup does not exist for asset " + asset); } group.addAsset(asset); } AssetGroupManager(); AssetGroup createGroup(String name, AssetType type); List<AssetGroup> getGroups(); void addAsset(Asset asset);  }
@Test() public void testAddAsset() throws Exception { AssetGroupManager assetGroupManager = new AssetGroupManager(); AssetGroup fooGroup = assetGroupManager.createGroup("foo", AssetType.JAVASCRIPT); Asset asset1 = new Asset(); asset1.setType(AssetType.JAVASCRIPT); asset1.setGroup("foo"); assetGroupManager.addAsset(asset1); assertEquals(asset1, fooGroup.getAssets().get(0)); }