### Question:
GeogigFeatureStore extends ContentFeatureStore { @Override public final List<FeatureId> addFeatures( FeatureCollection<SimpleFeatureType, SimpleFeature> featureCollection) throws IOException { if (Transaction.AUTO_COMMIT.equals(getTransaction())) { throw new UnsupportedOperationException("GeoGIG does not support AUTO_COMMIT"); } Preconditions.checkState(getDataStore().isAllowTransactions(), "Transactions not supported; head is not a local branch"); final WorkingTree workingTree = delegate.getWorkingTree(); final String path = delegate.getTypeTreePath(); ProgressListener listener = new DefaultProgressListener(); final List<FeatureId> insertedFids = Lists.newArrayList(); List<Node> deferringTarget = new AbstractList<Node>() { @Override public boolean add(Node node) { String fid = node.getName(); String version = node.getObjectId().toString(); insertedFids.add(new FeatureIdVersionedImpl(fid, version)); return true; } @Override public Node get(int index) { throw new UnsupportedOperationException(); } @Override public int size() { return 0; } }; Integer count = (Integer) null; FeatureIterator<SimpleFeature> featureIterator = featureCollection.features(); try { Iterator<SimpleFeature> features; features = new FeatureIteratorIterator<SimpleFeature>(featureIterator); final SimpleFeatureType nativeSchema = delegate.getNativeType(); features = Iterators.transform(features, new SchemaInforcer(nativeSchema)); workingTree.insert(path, features, listener, deferringTarget, count); } catch (Exception e) { throw new IOException(e); } finally { featureIterator.close(); } return insertedFids; } GeogigFeatureStore(ContentEntry entry); @Override GeoGigDataStore getDataStore(); GeogigFeatureSource getFeatureSource(); @Override ContentEntry getEntry(); @Override ResourceInfo getInfo(); @Override Name getName(); @Override QueryCapabilities getQueryCapabilities(); @Override ContentState getState(); @Override synchronized Transaction getTransaction(); @Override synchronized void setTransaction(Transaction transaction); @Override final List<FeatureId> addFeatures(
            FeatureCollection<SimpleFeatureType, SimpleFeature> featureCollection); @Override void modifyFeatures(Name[] names, Object[] values, Filter filter); @Override void removeFeatures(Filter filter);  }### Answer:
@Test public void testAddFeatures() throws Exception { FeatureCollection<SimpleFeatureType, SimpleFeature> collection; collection = DataUtilities.collection(Arrays.asList((SimpleFeature) points1, (SimpleFeature) points2, (SimpleFeature) points3)); try { points.addFeatures(collection); fail("Expected UnsupportedOperationException on AUTO_COMMIT"); } catch (UnsupportedOperationException e) { assertTrue(e.getMessage().contains("AUTO_COMMIT")); } Transaction tx = new DefaultTransaction(); points.setTransaction(tx); assertSame(tx, points.getTransaction()); try { List<FeatureId> addedFeatures = points.addFeatures(collection); assertNotNull(addedFeatures); assertEquals(3, addedFeatures.size()); for (FeatureId id : addedFeatures) { assertFalse(id instanceof ResourceId); assertNotNull(id.getFeatureVersion()); } assertEquals(3, points.getFeatures().size()); assertEquals(0, dataStore.getFeatureSource(pointsTypeName).getFeatures().size()); tx.commit(); assertEquals(3, dataStore.getFeatureSource(pointsTypeName).getFeatures().size()); } catch (Exception e) { tx.rollback(); throw e; } finally { tx.close(); } }