Ref { public static Ref createSha1Ref(String name) { CheckUtilities.checkStringArgument(name, "name"); Ref cn = new Ref(); cn.refType = RefType.SHA1; 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 testCreateSha1Ref() { assertCreateSha1RefThrowsNPE(null, "000001: A String argument was not specified but is required. { variableName=[name] }"); assertCreateSha1RefThrowsIllegalArgException("", "000001: A String argument was not specified but is required. { variableName=[name] }"); Ref ref = Ref.createSha1Ref("a"); Ref ref2 = Ref.createSha1Ref("a"); assertEquals("Expected RefType of SHA1.", ref.getRefType(), Ref.RefType.SHA1); assertEquals(ref.getHeadOffset(), -1); assertEquals(ref.getName(), "a"); assertEquals(ref.getRepositoryName(), null); assertEquals(ref.toString(), "a"); assertEquals(ref, ref2); assertEquals(ref.hashCode(), ref2.hashCode()); ref = Ref.createSha1Ref("ab238dd4c9fa4d8eabe03715c3e8b212f9532013"); assertTrue(!ref.equals(ref2)); ref2 = Ref.createSha1Ref("ab238dd4c9fa4d8eabe03715c3e8b212f9532013"); assertEquals("Expected RefType of SHA1.", ref.getRefType(), Ref.RefType.SHA1); assertEquals(ref.getHeadOffset(), -1); assertEquals(ref.getName(), "ab238dd4c9fa4d8eabe03715c3e8b212f9532013"); assertEquals(ref.getRepositoryName(), null); assertEquals(ref.toString(), "ab238dd4c9fa4d8eabe03715c3e8b212f9532013"); assertEquals(ref, ref2); assertEquals(ref.hashCode(), ref2.hashCode()); }