### Question:
Ref implements Comparable<Ref> { public static String stripCommonPrefix(final @NonNull String ref) { Preconditions.checkArgument(!Strings.isNullOrEmpty(ref)); if (ref.indexOf('/') == -1) { return ref; } if (ref.startsWith(Ref.HEADS_PREFIX)) { return ref.substring(Ref.HEADS_PREFIX.length()); } if (ref.startsWith(Ref.TAGS_PREFIX)) { return ref.substring(Ref.TAGS_PREFIX.length()); } if (ref.startsWith(Ref.REFS_PREFIX)) { return ref.substring(Ref.REFS_PREFIX.length()); } return ref; } Ref(final @NonNull String name, final @NonNull ObjectId oid); String getName(); String localName(); static String localName(final String ref); String namespace(); static String namespace(final String ref); static Optional<String> remoteName(final String ref); static String parentPath(final String ref); static String simpleName(final String ref); ObjectId getObjectId(); @Override boolean equals(Object o); @Override int hashCode(); @Override int compareTo(Ref o); @Override String toString(); static String append(String namespace, String child); static String child(String namespace, String ref); Ref peel(); static boolean isChild(@NonNull String parent, @NonNull String ref); static String stripCommonPrefix(final @NonNull String ref); static final String MASTER; static final String HEAD; static final String STAGE_HEAD; static final String WORK_HEAD; static final String MERGE_HEAD; static final String CHERRY_PICK_HEAD; static final String ORIG_HEAD; static final String REFS_PREFIX; static final String REMOTES_PREFIX; static final String TAGS_PREFIX; static final String HEADS_PREFIX; static final String TRANSACTIONS_PREFIX; static final String ORIGIN; }### Answer:
@Test public void testStripCommonPrefix() { assertEquals("branch1", Ref.stripCommonPrefix("branch1")); assertEquals("branch1", Ref.stripCommonPrefix(Ref.HEADS_PREFIX + "branch1")); assertEquals("branch1", Ref.stripCommonPrefix(Ref.TAGS_PREFIX + "branch1")); assertEquals("branch1", Ref.stripCommonPrefix(Ref.REFS_PREFIX + "branch1")); assertEquals("/branch1", Ref.stripCommonPrefix("/" + "branch1")); }