### Question:
DropIndexOp extends AbstractGeoGigOp<IndexInfo> { public DropIndexOp setTreeRefSpec(String treeRefSpec) { this.treeRefSpec = treeRefSpec; return this; }  DropIndexOp setTreeRefSpec(String treeRefSpec); DropIndexOp setAttributeName(String attributeName);  }### Answer:
@Test public void testDropIndex() { createIndex(); Optional<IndexInfo> indexInfo = indexdb.getIndexInfo(worldPointsLayer.getName(), "geom"); assertTrue(indexInfo.isPresent()); IndexInfo oldIndexInfo = indexInfo.get(); Optional<ObjectId> indexedTreeId = indexdb.resolveIndexedTree(oldIndexInfo, worldPointsTree.getId()); assertTrue(indexedTreeId.isPresent()); IndexInfo droppedIndex = repo.command(DropIndexOp.class) .setTreeRefSpec(worldPointsLayer.getName()) .call(); assertEquals(oldIndexInfo, droppedIndex); indexInfo = indexdb.getIndexInfo(worldPointsLayer.getName(), "geom"); assertFalse(indexInfo.isPresent()); indexedTreeId = indexdb.resolveIndexedTree(droppedIndex, worldPointsTree.getId()); assertFalse(indexedTreeId.isPresent()); }
@Test public void testDropIndexWrongTreeName() { Exception e = assertThrows(IllegalArgumentException.class, repo.command(DropIndexOp.class) .setTreeRefSpec("nonexistent") ::call); assertThat(e.getMessage(), containsString("Can't find feature tree 'nonexistent'")); }
@Test public void testDropMultipleMatchingIndexes() { indexdb.createIndexInfo(worldPointsLayer.getName(), "x", IndexType.QUADTREE, null); indexdb.createIndexInfo(worldPointsLayer.getName(), "y", IndexType.QUADTREE, null); Exception e = assertThrows(IllegalStateException.class, repo.command(DropIndexOp.class) .setTreeRefSpec(worldPointsLayer.getName()) ::call); assertThat(e.getMessage(), containsString( "Multiple indexes were found for the specified tree, please specify the attribute.")); }