### Question:
ResolveFeatureType extends AbstractGeoGigOp<Optional<RevFeatureType>> { public ResolveFeatureType setRefSpec(String refSpec) { this.refSpec = refSpec; return this; }  ResolveFeatureType setRefSpec(String refSpec);  }### Answer:
@Test public void testResolveFeatureType() throws Exception { insertAndAdd(points1); repo.command(CommitOp.class).setMessage("Commit1").call(); Optional<RevFeatureType> featureType = repo.command(ResolveFeatureType.class) .setRefSpec(pointsName).call(); assertTrue(featureType.isPresent()); assertEquals(pointsName, featureType.get().getName().getLocalPart()); assertEquals(TYPE.FEATURETYPE, featureType.get().getType()); }
@Test public void testResolveFeatureTypeWithColonInFeatureTypeName() throws Exception { insertAndAdd(points1); repo.command(CommitOp.class).setMessage("Commit1").call(); Optional<RevFeatureType> featureType = repo.command(ResolveFeatureType.class) .setRefSpec("WORK_HEAD:" + pointsName).call(); assertTrue(featureType.isPresent()); assertEquals(pointsName, featureType.get().getName().getLocalPart()); assertEquals(TYPE.FEATURETYPE, featureType.get().getType()); }
@Test public void testObjectNotInIndex() throws Exception { insertAndAdd(points1); repo.command(CommitOp.class).setMessage("Commit1").call(); Optional<RevFeatureType> featureType = repo.command(ResolveFeatureType.class) .setRefSpec("WORK_HEAD:" + linesName).call(); assertFalse(featureType.isPresent()); }
@Test public void testResolveFeatureTypeFromFeatureRefspec() throws Exception { insertAndAdd(points1); repo.command(CommitOp.class).setMessage("Commit1").call(); Optional<RevFeatureType> featureType = repo.command(ResolveFeatureType.class) .setRefSpec("WORK_HEAD:" + NodeRef.appendChild(pointsName, idP1)).call(); assertTrue(featureType.isPresent()); }
@Test public void testResolveFeatureType() throws Exception { insertAndAdd(points1); geogig.command(CommitOp.class).setMessage("Commit1").call(); Optional<RevFeatureType> featureType = geogig.command(ResolveFeatureType.class) .setRefSpec(pointsName).call(); assertTrue(featureType.isPresent()); assertEquals(pointsTypeName, featureType.get().getName()); assertEquals(TYPE.FEATURETYPE, featureType.get().getType()); }
@Test public void testResolveFeatureTypeWithColonInFeatureTypeName() throws Exception { insertAndAdd(points1); geogig.command(CommitOp.class).setMessage("Commit1").call(); Optional<RevFeatureType> featureType = geogig.command(ResolveFeatureType.class) .setRefSpec("WORK_HEAD:" + pointsName).call(); assertTrue(featureType.isPresent()); assertEquals(pointsTypeName, featureType.get().getName()); assertEquals(TYPE.FEATURETYPE, featureType.get().getType()); }
@Test public void testObjectNotInIndex() throws Exception { insertAndAdd(points1); geogig.command(CommitOp.class).setMessage("Commit1").call(); Optional<RevFeatureType> featureType = geogig.command(ResolveFeatureType.class) .setRefSpec("WORK_HEAD:" + linesName).call(); assertFalse(featureType.isPresent()); }
@Test public void testResolveFeatureTypeFromFeatureRefspec() throws Exception { insertAndAdd(points1); geogig.command(CommitOp.class).setMessage("Commit1").call(); Optional<RevFeatureType> featureType = geogig.command(ResolveFeatureType.class) .setRefSpec("WORK_HEAD:" + NodeRef.appendChild(pointsName, idP1)).call(); assertTrue(featureType.isPresent()); }