### Question:
FeatureImporter { public void importFeatures(GeoPackage geopackage, Map<String, GeoPackageFeatureLayer> featureLayers, CancellableTaskActivity ta, ProgressModel model) { for (Entry<String, GeoPackageFeatureLayer> entry : featureLayers.entrySet()) { String featureTable = entry.getKey(); FeatureDao featureDao = geopackage.getFeatureDao(featureTable); List<Map<String, Serializable>> importedData = myTableImporter.importFeatures(featureDao, ta, model); entry.getValue().getData().addAll(importedData); if (ta.isCancelled()) { break; } } }  void importFeatures(GeoPackage geopackage, Map<String, GeoPackageFeatureLayer> featureLayers,
            CancellableTaskActivity ta, ProgressModel model);  }### Answer:
@Test public void testImportFeatures() { EasyMockSupport support = new EasyMockSupport(); Map<String, GeoPackageFeatureLayer> layers = createLayers(); List<String> layerNames = New.list(layers.keySet()); GeoPackage geopackage = createPackage(support, layerNames, null); CancellableTaskActivity ta = new CancellableTaskActivity(); ProgressModel model = new ProgressModel(); support.replayAll(); FeatureImporter importer = new FeatureImporter(); importer.importFeatures(geopackage, layers, ta, model); assertEquals(6, model.getCompletedCount()); int layerIndex = 0; for (String layerName : layerNames) { GeoPackageFeatureLayer layer = layers.get(layerName); List<Map<String, Serializable>> data = layer.getData(); assertEquals(3, data.size()); int index = 0; for (Map<String, Serializable> row : data) { assertEquals(4, row.size()); int valueAdder = 100 + layerIndex; assertEquals("value" + index + valueAdder, row.get("column1")); assertEquals(10 + index + valueAdder, row.get("column2")); assertEquals(54.3 + index + valueAdder, row.get("column3")); Point actualLocation = (Point)row.get(GeoPackageColumns.GEOMETRY_COLUMN); assertEquals(actualLocation.getCoordinate().x, 5 + index + valueAdder, 0d); assertEquals(actualLocation.getCoordinate().y, 6 + index + valueAdder, 0d); index++; } layerIndex++; } support.verifyAll(); }
@Test public void testImportFeaturesCancelled() { EasyMockSupport support = new EasyMockSupport(); Map<String, GeoPackageFeatureLayer> layers = createLayers(); List<String> layerNames = New.list(layers.keySet()); CancellableTaskActivity ta = new CancellableTaskActivity(); GeoPackage geopackage = createPackage(support, layerNames, ta); ProgressModel model = new ProgressModel(); support.replayAll(); FeatureImporter importer = new FeatureImporter(); importer.importFeatures(geopackage, layers, ta, model); assertEquals(0, model.getCompletedCount()); support.verifyAll(); }