@Test
public void testHeadNotVisible() throws Exception {

  ObjectIdRef.Unpeeled bar =
      new ObjectIdRef.Unpeeled(LOOSE, R_HEADS + "bar", idA);
  Map<String, Ref> u = new LinkedHashMap<String, Ref>();
  u.put(bar.getName(), bar);
  u.put(HEAD, new SymbolicRef(HEAD, bar));
  validate().andReturn(pc);
  expect(grm.openRepository(eq(name))).andReturn(mockDb);
  expect(mockDb.getAllRefs()).andReturn(u);
  assumeVisible(bar, false, targets(u));
  assumeVisible(bar, false, targets(u));
  expect(pc.canAddRefs()).andReturn(true);
  mockDb.close();
  expectLastCall();
  doReplay();
  final ListBranchesResult r = new ListBranches(pcf, grm, name).call();
  doVerify();
  assertNotNull(r);
  assertTrue(r.getBranches().isEmpty());
}