### Question:
FeedGroupMap implements ConfigurationChangeListener { @Override public void onRemove(Entity entity) throws FalconException { if (entity.getEntityType().equals(EntityType.FEED)) { Feed feed = (Feed) entity; if (StringUtils.isEmpty(feed.getGroups())) { return; } String[] groups = feed.getGroups().split(","); for (String group : groups) { groupsMapping.get(group).getFeeds().remove(entity.getName()); if (groupsMapping.get(group).getFeeds().size() == 0) { groupsMapping.remove(group); } } } } private  FeedGroupMap(); static FeedGroupMap get(); Map<String, FeedGroup> getGroupsMapping(); @Override void onAdd(Entity entity); @Override void onRemove(Entity entity); @Override void onChange(Entity oldEntity, Entity newEntity); @Override void onReload(Entity entity); Set<FeedGroup> getGroups(String groups, Frequency frequency, String path); Set<FeedGroup> getGroups(org.apache.falcon.entity.v0.feed.Feed feed);  }### Answer:
@Test public void testOnRemove() throws FalconException, JAXBException { Feed feed1 = (Feed) EntityType.FEED.getUnmarshaller().unmarshal( FeedGroupMapTest.class .getResourceAsStream("/config/feed/feed-0.1.xml")); feed1.setName("f1"); getStore().publish(EntityType.CLUSTER, cluster); feed1.setGroups("group7,group8,group9"); Location location = new Location(); location.setPath("/projects/bi/rmc/daily/ad/${YEAR}/fraud/${MONTH}-${DAY}/ad"); location.setType(LocationType.DATA); feed1.setLocations(new Locations()); feed1.getLocations().getLocations().add(location); getStore().publish(EntityType.FEED, feed1); Feed feed2 = (Feed) EntityType.FEED.getUnmarshaller().unmarshal( FeedGroupMapTest.class .getResourceAsStream("/config/feed/feed-0.1.xml")); feed2.setName("f2"); feed2.setGroups("group7,group8,group10"); location.setPath("/projects/bi/rmc/daily/ad/${YEAR}/${MONTH}/${DAY}/ad2"); location.setType(LocationType.DATA); feed2.setLocations(new Locations()); feed2.getLocations().getLocations().add(location); getStore().publish(EntityType.FEED, feed2); Map<String, FeedGroup> groupMapping = FeedGroupMap.get() .getGroupsMapping(); getStore().remove(EntityType.FEED, "f2"); FeedGroup group = groupMapping.get("group7"); Assert.assertEquals(group.getName(), "group7"); Assert.assertEquals(group.getFeeds().size(), 1); group = groupMapping.get("group8"); Assert.assertEquals(group.getName(), "group8"); Assert.assertEquals(group.getFeeds().size(), 1); group = groupMapping.get("group10"); Assert.assertEquals(null, group); getStore().remove(EntityType.FEED, "f1"); group = groupMapping.get("group7"); Assert.assertEquals(null, group); group = groupMapping.get("group8"); Assert.assertEquals(null, group); group = groupMapping.get("group9"); Assert.assertEquals(null, group); }