### Question:
WFSGovernor extends TimeSpanGovernor implements QueryTrackerListener { @Override public void clearData() { try { myDataClearer.removeAll(); super.clearData(); } catch (DataElementLookupException e) { LOGGER.error(e, e); } } WFSGovernor(MantleToolbox mantle, DataRegistry dataRegistry, DataTypeInfo wfsLayer, QueryRegion region); @Override void clearData(); @Override void clearData(Collection<? extends TimeSpan> spans); @Override void fractionCompleteChanged(QueryTracker tracker, float fractionComplete); @Override void statusChanged(QueryTracker tracker, QueryStatus status);  }### Answer:
@Test public void testClearData() throws DataElementLookupException { EasyMockSupport support = new EasyMockSupport(); TimeSpan span1 = TimeSpan.get(System.currentTimeMillis() - 10000, System.currentTimeMillis() - 5000); TimeSpan span2 = TimeSpan.get(System.currentTimeMillis() - 3000, System.currentTimeMillis()); List<Long> allIds = New.list(Long.valueOf(0), Long.valueOf(1), Long.valueOf(2), Long.valueOf(3)); DataTypeInfo layer = createLayerClear(support); List<MapGeometrySupport> geometrySupports = New.list(); List<DataElement> elements = createElements(span1, span2, geometrySupports); DataElementCache cache = createCache(support, layer, allIds, null); DataElementLookupUtils lookupUtils = createLookup(support, layer, allIds, elements); DataTypeController typeController = createTypeController(support, layer, new long[] { 1, 3 }); MapGeometrySupportConverterRegistry converter = createConverter(support, geometrySupports); MantleToolbox mantle = createMantle(support, cache, lookupUtils, typeController, converter); QueryRegion queryArea = createRegion(support); DataRegistry registry = support.createMock(DataRegistry.class); support.replayAll(); WFSGovernor governor = new WFSGovernor(mantle, registry, layer, queryArea); governor.clearData(); support.verifyAll(); }
@Test public void testClearDataSpan() throws DataElementLookupException { EasyMockSupport support = new EasyMockSupport(); TimeSpan span1 = TimeSpan.get(System.currentTimeMillis() - 10000, System.currentTimeMillis() - 5000); TimeSpan span2 = TimeSpan.get(System.currentTimeMillis() - 3000, System.currentTimeMillis()); List<Long> allIds = New.list(Long.valueOf(0), Long.valueOf(1), Long.valueOf(2), Long.valueOf(3)); DataTypeInfo layer = createLayerClear(support); List<MapGeometrySupport> geometrySupports = New.list(); List<DataElement> elements = createElements(span1, span2, geometrySupports); DataElementCache cache = createCache(support, layer, allIds, New.list(span1, span1, span2, span2)); DataElementLookupUtils lookupUtils = createLookup(support, layer, New.list(Long.valueOf(2), Long.valueOf(3)), New.list(elements.get(2), elements.get(3))); DataTypeController typeController = createTypeController(support, layer, new long[] { 3 }); MapGeometrySupportConverterRegistry converter = createConverter(support, New.list(geometrySupports.get(2), geometrySupports.get(3))); MantleToolbox mantle = createMantle(support, cache, lookupUtils, typeController, converter); QueryRegion queryArea = createRegion(support); DataRegistry registry = support.createMock(DataRegistry.class); support.replayAll(); WFSGovernor governor = new WFSGovernor(mantle, registry, layer, queryArea); governor.clearData(New.list(span2)); support.verifyAll(); }