Ref { public static Ref createTagRef(String name) { CheckUtilities.checkStringArgument(name, "name"); Ref cn = new Ref(); cn.refType = RefType.TAG; 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 testCreateTagRef() { assertCreateTagRefThrowsNPE(null, "000001: A String argument was not specified but is required. { variableName=[name] }"); assertCreateTagRefThrowsIllegalArgException("", "000001: A String argument was not specified but is required. { variableName=[name] }"); Ref ref = Ref.createTagRef("v2.1"); Ref ref2 = Ref.createTagRef("v2.1"); assertEquals("Expected RefType of TAG.", ref.getRefType(), Ref.RefType.TAG); assertEquals(ref.getHeadOffset(), -1); assertEquals(ref.getName(), "v2.1"); assertEquals(ref.getRepositoryName(), null); assertEquals(ref.toString(), "v2.1"); assertEquals(ref, ref2); assertEquals(ref.hashCode(), ref2.hashCode()); ref = Ref.createTagRef("Release-5.5.2"); assertTrue(!ref.equals(ref2)); ref2 = Ref.createTagRef("Release-5.5.2"); assertEquals("Expected RefType of TAG.", ref.getRefType(), Ref.RefType.TAG); assertEquals(ref.getHeadOffset(), -1); assertEquals(ref.getName(), "Release-5.5.2"); assertEquals(ref.getRepositoryName(), null); assertEquals(ref.toString(), "Release-5.5.2"); assertEquals(ref, ref2); assertEquals(ref.hashCode(), ref2.hashCode()); }