### Question:
DataTypeControllerFeatureConsumer extends FeatureConsumer { @Override public void flush() { List<MapDataElement> features = consumeFeatures(); if (features == null || features.isEmpty()) { return; } synchronized (idSet) { if (killed) { return; } if (!ctrl.hasDataTypeInfoForTypeKey(myType.getTypeKey())) { ctrl.addDataType(getClass().getSimpleName(), myType.getTypeKey(), myType, this); } features = dontAddElementOutsideLoadTime(features); if (!features.isEmpty()) { idSet.addAll(ctrl.addMapDataElements(myType, null, null, features, this)); } } } DataTypeControllerFeatureConsumer(DataTypeController dataTypeController, TimeManager timeManager, DataTypeInfo info,
            int flushSize); @Override void cleanup(); @Override void flush();  }### Answer:
@Test public void testFlushNoTime() { EasyMockSupport support = new EasyMockSupport(); DataTypeInfo dataType = createDataType(support); List<TimeSpan> loadSpans = New.list(TimeSpan.get(System.currentTimeMillis() - 20000, System.currentTimeMillis() - 15000), TimeSpan.get(System.currentTimeMillis() - 10000, System.currentTimeMillis())); List<MapDataElement> elements = createFeatures(support, loadSpans, false); TimeManager timeManager = null; DataTypeController typeController = createTypeController(support, dataType, elements); support.replayAll(); DataTypeControllerFeatureConsumer consumer = new DataTypeControllerFeatureConsumer(typeController, timeManager, dataType, 1); consumer.addFeatures(elements); consumer.flush(); support.verifyAll(); }
@Test public void testFlushTime() { EasyMockSupport support = new EasyMockSupport(); DataTypeInfo dataType = createDataType(support); List<TimeSpan> loadSpans = New.list(TimeSpan.get(System.currentTimeMillis() - 20000, System.currentTimeMillis() - 15000), TimeSpan.get(System.currentTimeMillis() - 10000, System.currentTimeMillis())); List<MapDataElement> elements = createFeatures(support, loadSpans, true); TimeManager timeManager = createTimeManager(support, loadSpans); DataTypeController typeController = createTypeController(support, dataType, New.list(elements.get(0), elements.get(2), elements.get(3))); support.replayAll(); DataTypeControllerFeatureConsumer consumer = new DataTypeControllerFeatureConsumer(typeController, timeManager, dataType, 1); consumer.addFeatures(elements); consumer.flush(); support.verifyAll(); }