### Question:
AerialPlatformResultHandler implements ResultHandler, EventListener<ActiveDataGroupsChangedEvent> { @Override public void handleGroupActivation(DataTypeInfo dataType, ActivationState state) { if (state != ActivationState.ACTIVE) { myToolbox.getTransformerRegistry().removeObjectsForSource(dataType); } else if (state == ActivationState.ACTIVE) { String typeKey = dataType.getTypeKey(); synchronized (myVideoLayer) { if (!myVideoLayer.containsKey(typeKey)) { myVideoLayer.put(typeKey, New.list()); } } myToolbox.getTransformerRegistry().addObjectsForSource(dataType, New.list(new AerialImageryTransformer(myToolbox, myQuerier, dataType, myVideoLayer.get(typeKey)))); } } AerialPlatformResultHandler(Toolbox toolbox, OSHImageQuerier querier); @Override List<Output> canHandle(List<Output> outputs); @Override String getQueryProperty(Offering offering, Output output); @Override void handleGroupActivation(DataTypeInfo dataType, ActivationState state); @Override void handleResults(OSHDataTypeInfo dataType, List<Output> outputs, List<CancellableInputStream> streams); @Override void initializeType(OSHDataTypeInfo dataType); @Override void notify(ActiveDataGroupsChangedEvent event);  }### Answer:
@Test public void testHandleGroupActivation() { EasyMockSupport support = new EasyMockSupport(); DataRegistry dataRegistry = support.createMock(DataRegistry.class); UIRegistry uiRegistry = support.createMock(UIRegistry.class); OSHImageQuerier querier = support.createMock(OSHImageQuerier.class); PreferencesRegistry prefsRegistry = createPrefsRegistryBasic(support); Toolbox toolbox = createToolbox(support, dataRegistry, uiRegistry, prefsRegistry); TimeManager timeManager = support.createMock(TimeManager.class); timeManager.addActiveTimeSpanChangeListener(EasyMock.isA(TimeRefreshNotifier.class)); EasyMock.expect(toolbox.getTimeManager()).andReturn(timeManager); OrderManagerRegistry orderRegistry = support.createMock(OrderManagerRegistry.class); EasyMock.expect(toolbox.getOrderManagerRegistry()).andReturn(orderRegistry); AnimationManager animationManager = support.createMock(AnimationManager.class); animationManager.addAnimationChangeListener(EasyMock.isA(TimeRefreshNotifier.class)); EasyMock.expect(toolbox.getAnimationManager()).andReturn(animationManager); MapManager mapManager = support.createMock(MapManager.class); EasyMock.expect(toolbox.getMapManager()).andReturn(mapManager); List<Output> validOuts = createValidOutputs(); Offering offering = createOffering(); OSHDataTypeInfo dataType = createDataType(offering, validOuts); support.replayAll(); AerialPlatformResultHandler handler = new AerialPlatformResultHandler(toolbox, querier); handler.handleGroupActivation(dataType, ActivationState.ACTIVE); assertTrue(toolbox.getTransformerRegistry().getObjectsForSource(dataType).iterator() .next() instanceof AerialImageryTransformer); handler.handleGroupActivation(dataType, ActivationState.DEACTIVATING); assertTrue(toolbox.getTransformerRegistry().getObjectsForSource(dataType).isEmpty()); support.verifyAll(); }