### Question:
RevParse extends AbstractGeoGigOp<Optional<ObjectId>> { public RevParse setRefSpec(final String refSpec) { this.refSpec = refSpec; return this; }  RevParse setRefSpec(final String refSpec);  }### Answer:
@Test public void testRevParseWithFeatureObjectIdAndDelimiter() { exception.expect(IllegalArgumentException.class); geogig.command(RevParse.class).setRefSpec(loId1.toString() + "^").call(); }
@Test public void testRevParseWithFeatureCheckIfCommit() { exception.expect(IllegalArgumentException.class); geogig.command(RevParse.class).setRefSpec(loId1.toString() + "^0").call(); }
@Test public void testRevParseWithInvalidRefSpec() { Optional<ObjectId> oid = geogig.command(RevParse.class) .setRefSpec("WORK_HEAD:Lines/Lines.1").call(); assertFalse(oid.isPresent()); }
@Test public void testRevParseVerifyToWrongType() { exception.expect(IllegalArgumentException.class); geogig.command(RevParse.class).setRefSpec(poId1.toString() + "^{commit}").call(); }
@Test public void testRevParseVerifyWithInvalidType() { exception.expect(IllegalArgumentException.class); geogig.command(RevParse.class).setRefSpec(poId1.toString() + "^{blah}").call(); }
@Test public void testResolveToMultipleIds() { StagingDatabase mockIndexDb = mock(StagingDatabase.class); Context mockCommands = mock(Context.class); RefParse mockRefParse = mock(RefParse.class); when(mockRefParse.setName(anyString())).thenReturn(mockRefParse); when(mockCommands.command(eq(RefParse.class))).thenReturn(mockRefParse); Optional<Ref> ref = Optional.absent(); when(mockRefParse.call()).thenReturn(ref); List<ObjectId> oIds = Arrays.asList(ObjectId.forString("Object 1"), ObjectId.forString("Object 2")); when(mockIndexDb.lookUp(anyString())).thenReturn(oIds); when(mockCommands.stagingDatabase()).thenReturn(mockIndexDb); RevParse command = new RevParse(); command.setContext(mockCommands); exception.expect(IllegalArgumentException.class); command.setRefSpec(commitId1.toString().substring(0, commitId1.toString().length() - 2)) .call(); }