Ref { public static Ref createBranchRef(String name) { CheckUtilities.checkStringArgument(name, "name"); Ref cn = new Ref(); cn.refType = RefType.BRANCH; cn.name = name; return cn; }  static Ref createBranchRef(String name); static Ref createHeadRef(int headOffset); static Ref createRemoteRef(String repositoryName, String name); static Ref createSha1Ref(String name); static Ref createTagRef(String name); Ref.RefType getRefType(); int getHeadOffset(); String getName(); String getRepositoryName(); @Override String toString(); @Override boolean equals(Object o); @Override int hashCode(); static final Ref HEAD; static final Ref HEAD_1; }
@Test public void testCreateBranchRef() { assertCreateBranchRefThrowsNPE(null, "000001: A String argument was not specified but is required. { variableName=[name] }"); assertCreateBranchRefThrowsIllegalArgException("", "000001: A String argument was not specified but is required. { variableName=[name] }"); Ref ref = Ref.createBranchRef("master"); Ref ref2 = Ref.createBranchRef("master"); assertEquals("Expected RefType of BRANCH.", ref.getRefType(), Ref.RefType.BRANCH); assertEquals(ref.getHeadOffset(), -1); assertEquals(ref.getName(), "master"); assertEquals(ref.getRepositoryName(), null); assertEquals(ref.toString(), "master"); assertEquals(ref, ref2); assertEquals(ref.hashCode(), ref2.hashCode()); ref = Ref.createBranchRef("myTestBranch"); assertTrue(!ref.equals(ref2)); ref2 = Ref.createBranchRef("myTestBranch"); assertEquals("Expected RefType of BRANCH.", ref.getRefType(), Ref.RefType.BRANCH); assertEquals(ref.getHeadOffset(), -1); assertEquals(ref.getName(), "myTestBranch"); assertEquals(ref.getRepositoryName(), null); assertEquals(ref.toString(), "myTestBranch"); assertEquals(ref, ref2); assertEquals(ref.hashCode(), ref2.hashCode()); }