### Question:
MergeGroupActivationListener extends AbstractActivationListener { @Override public void handleCommit(boolean active, DataGroupInfo dgi, PhasedTaskCanceller canceller) { super.handleCommit(active, dgi, canceller); if (active) { Iterator<DataTypeInfo> mergedLayers = dgi.getMembers(false).iterator(); if (mergedLayers.hasNext()) { DataTypeInfo mergedLayer = mergedLayers.next(); DataModelCategory category = DataRegistryUtils.getInstance().getMergeDataCategory(mergedLayer.getTypeKey()); SimpleQuery<MergedDataRow> simpleQuery = new SimpleQuery<>(category, DataRegistryUtils.MERGED_PROP_DESCRIPTOR); myRegistry.performLocalQuery(simpleQuery); if (simpleQuery.getResults() != null && !simpleQuery.getResults().isEmpty()) { myTypeController.addDataElements(new MergeDataElementProvider(mergedLayer, simpleQuery.getResults()), null, null, this); } } } } MergeGroupActivationListener(DataRegistry registry, DataTypeController typeController); @Override void handleCommit(boolean active, DataGroupInfo dgi, PhasedTaskCanceller canceller);  }### Answer:
@Test public void testHandleCommit() { EasyMockSupport support = new EasyMockSupport(); List<MergedDataRow> data = New.list(); Map<String, Serializable> row1Map = New.map(); row1Map.put("column1", "value1"); MergedDataRow row1 = new MergedDataRow(row1Map, null, null); data.add(row1); Map<String, Serializable> row2Map = New.map(); row2Map.put("column1", "value2"); MergedDataRow row2 = new MergedDataRow(row2Map, null, null); data.add(row2); DataRegistry registry = createRegistry(support, data); List<DataElement> elements = New.list(); DataTypeController typeController = createController(support, elements); DataGroupInfo dgi = createGroupInfo(support); support.replayAll(); MergeGroupActivationListener listener = new MergeGroupActivationListener(registry, typeController); listener.handleCommit(true, dgi, null); assertEquals(2, elements.size()); assertEquals("value1", elements.get(0).getMetaData().getValue("column1")); assertEquals("value2", elements.get(1).getMetaData().getValue("column1")); support.verifyAll(); }
@Test public void testHandleCommitDeactivate() { EasyMockSupport support = new EasyMockSupport(); DataRegistry registry = support.createMock(DataRegistry.class); DataTypeController typeController = support.createMock(DataTypeController.class); DataGroupInfo dgi = support.createMock(DataGroupInfo.class); support.replayAll(); MergeGroupActivationListener listener = new MergeGroupActivationListener(registry, typeController); listener.handleCommit(false, dgi, null); support.verifyAll(); }
@Test public void testHandleCommitEmptyQuery() { EasyMockSupport support = new EasyMockSupport(); DataRegistry registry = createRegistry(support, New.list()); DataTypeController typeController = support.createMock(DataTypeController.class); DataGroupInfo dgi = createGroupInfo(support); support.replayAll(); MergeGroupActivationListener listener = new MergeGroupActivationListener(registry, typeController); listener.handleCommit(true, dgi, null); support.verifyAll(); }