### Question:
IdReference { public static String extractName(String uri) { if (uri == null) return null; String noSlashAtEnd = uri.replaceAll("/+$", ""); return noSlashAtEnd.substring(noSlashAtEnd.lastIndexOf('/') + 1); }  @Nullable abstract String id(); @Nullable String resourceGroup(); @Nullable String name(); @SerializedNames({"id"}) static IdReference create(final String id); static String extractName(String uri); static String extractResourceGroup(String uri);  }### Answer:
@Test public void testExtractName() { assertEquals(extractName(null), null); assertEquals(extractName(""), ""); assertEquals(extractName("foo"), "foo"); assertEquals(extractName("/foo/bar"), "bar"); assertEquals(extractName("/foo/bar/"), "bar"); assertEquals(extractName("/foo/bar assertEquals(extractName("/foo assertEquals(extractName(" }