### Question:
BuildFullHistoryIndexOp extends AbstractGeoGigOp<Integer> { public BuildFullHistoryIndexOp setTreeRefSpec(String treeRefSpec) { this.treeRefSpec = treeRefSpec; return this; }  BuildFullHistoryIndexOp setTreeRefSpec(String treeRefSpec); BuildFullHistoryIndexOp setAttributeName(String attributeName); BuildFullHistoryIndexOp setMissingOnly(boolean onlyMissing);  }### Answer:
@Test public void testBuildFullHistoryNoAttributeName() { indexInfo = createIndex("x", "xystr"); int treesUpdated = repo.command(BuildFullHistoryIndexOp.class) .setTreeRefSpec(indexInfo.getTreeName()) .call(); assertEquals(4, treesUpdated); ObjectId canonicalFeatureTreeId = repo.command(ResolveTreeish.class) .setTreeish("HEAD:" + worldPointsLayer.getName()).call().get(); Optional<ObjectId> indexedTreeId = indexdb.resolveIndexedTree(indexInfo, canonicalFeatureTreeId); assertTrue(indexedTreeId.isPresent()); IndexTestSupport.verifyIndex(repo.context(), indexedTreeId.get(), canonicalFeatureTreeId, "x", "xystr"); canonicalFeatureTreeId = repo.command(ResolveTreeish.class) .setTreeish("HEAD~1:" + worldPointsLayer.getName()).call().get(); indexedTreeId = indexdb.resolveIndexedTree(indexInfo, canonicalFeatureTreeId); assertTrue(indexedTreeId.isPresent()); IndexTestSupport.verifyIndex(repo.context(), indexedTreeId.get(), canonicalFeatureTreeId, "x", "xystr"); canonicalFeatureTreeId = repo.command(ResolveTreeish.class) .setTreeish("HEAD~2:" + worldPointsLayer.getName()).call().get(); indexedTreeId = indexdb.resolveIndexedTree(indexInfo, canonicalFeatureTreeId); assertTrue(indexedTreeId.isPresent()); IndexTestSupport.verifyIndex(repo.context(), indexedTreeId.get(), canonicalFeatureTreeId, "x", "xystr"); canonicalFeatureTreeId = repo.command(ResolveTreeish.class) .setTreeish("branch1:" + worldPointsLayer.getName()).call().get(); indexedTreeId = indexdb.resolveIndexedTree(indexInfo, canonicalFeatureTreeId); assertTrue(indexedTreeId.isPresent()); IndexTestSupport.verifyIndex(repo.context(), indexedTreeId.get(), canonicalFeatureTreeId, "x", "xystr"); }
@Test public void testBuildFullHistoryNoIndex() { assertThat(assertThrows(IllegalStateException.class, repo.command(BuildFullHistoryIndexOp.class) .setTreeRefSpec(worldPointsLayer.getName()) ::call).getMessage(), containsString("A matching index could not be found.")); }
@Test public void testBuildFullHistoryMultipleMatchingIndexes() { indexdb.createIndexInfo(worldPointsLayer.getName(), "x", IndexType.QUADTREE, null); indexdb.createIndexInfo(worldPointsLayer.getName(), "y", IndexType.QUADTREE, null); assertThat(assertThrows(IllegalStateException.class, repo.command(BuildFullHistoryIndexOp.class) .setTreeRefSpec(worldPointsLayer.getName()) ::call).getMessage(), containsString( "Multiple indexes were found for the specified tree, please specify the attribute.")); }