### Question:
RefParse extends AbstractGeoGigOp<Optional<Ref>> { public RefParse setName(String name) { this.refSpec = name; return this; }  RefParse setName(String name);  }### Answer:
@Test public void testParseCompleteRef() { String refName = "refs/heads/master"; Optional<Ref> ref = command.setName(refName).call(); assertTrue(ref.isPresent()); assertEquals(refName, ref.get().getName()); assertEquals(RevObjectTestSupport.hashString(refName), ref.get().getObjectId()); refName = "refs/remotes/juan/v1.1"; testRsolvePartial(refName, refName); }
@Test public void testResolveSymbolicRef() { Ref target = testRef("refs/heads/branch1"); Ref head = new SymRef(Ref.HEAD, target); refDb.put(target); refDb.put(head); Optional<Ref> ref = command.setName("HEAD").call(); assertTrue(ref.isPresent()); assertTrue(ref.get() instanceof SymRef); assertEquals("HEAD", ref.get().getName()); assertEquals("refs/heads/branch1", ((SymRef) ref.get()).getTarget()); }
@Test public void testNonExistentRef() { assertFalse(command.setName("HEADs").call().isPresent()); assertFalse(command.setName("remotes/upstream").call().isPresent()); assertFalse(command.setName("refs/remotes/origin/badbranch").call().isPresent()); }
@Test public void testParseCompleteRef() { String refName = "refs/heads/master"; Optional<Ref> ref = command.setName(refName).call(); assertTrue(ref.isPresent()); assertEquals(refName, ref.get().getName()); assertEquals(forString(refName), ref.get().getObjectId()); refName = "refs/remotes/juan/v1.1"; testRsolvePartial(refName, refName); }