### Question:
FilterManagerStateController extends AbstractModuleStateController { static void combineQueryEntries(List<QueryEntryType> queryEntries) { for (int i = queryEntries.size() - 1; i >= 0; i--) { QueryEntryType entry1 = queryEntries.get(i); boolean didCombine = false; for (int j = i - 1; j >= 0; j--) { QueryEntryType entry2 = queryEntries.get(j); if (canCombine(entry1, entry2)) { QueryEntryType combined = combine(entry1, entry2); queryEntries.set(j, combined); didCombine = true; } } if (didCombine) { queryEntries.remove(i); } } } FilterManagerStateController(FilterBuilderController fbController, DataGroupController dataTypeController,
            DataFilterRegistry filterRegistry, QueryRegionManager queryRegionManager, GeometryRegistry geometryRegistry); @Override void activateState(String id, String description, Collection<? extends String> tags, Node node); @Override void activateState(String id, String description, Collection<? extends String> tags, StateType state); @Override boolean canActivateState(Node node); @Override boolean canActivateState(StateType state); @Override boolean canSaveState(); @Override void deactivateState(String id, Node node); @Override void deactivateState(String id, StateType state); @Override List<? extends String> getRequiredStateDependencies(); @Override boolean isSaveStateByDefault(); @Override void saveState(Node node); @Override void saveState(StateType state);  }### Answer:
@Test public void testCombineQueryEntries() { List<QueryEntryType> entries = New.list(); entries.add(newQueryEntry("l1", null, "f1")); entries.add(newQueryEntry("l1", "a1", null)); entries.add(newQueryEntry("l1", "a1", "f2")); entries.add(newQueryEntry("l1", null, null)); entries.add(newQueryEntry("l3", "a3", "f3")); FilterManagerStateController.combineQueryEntries(entries); Assert.assertEquals(3, entries.size()); Assert.assertEquals(null, entries.get(0).getAreaId()); Assert.assertEquals("f1", entries.get(0).getFilterId()); Assert.assertEquals("a1", entries.get(1).getAreaId()); Assert.assertEquals("f2", entries.get(1).getFilterId()); Assert.assertEquals("a3", entries.get(2).getAreaId()); Assert.assertEquals("f3", entries.get(2).getFilterId()); }