### Question:
XmppStringUtils { public static String parseResource(String jid) { int slashIndex = jid.indexOf('/'); if (slashIndex < 0) { return null; } if (slashIndex + 1 > jid.length()) { return ""; } else { return jid.substring(slashIndex + 1); } }  static String parseLocalpart(String jid); static String parseDomain(String jid); static String parseResource(String jid); static String parseBareJid(String jid); static boolean isFullJID(String jid); static boolean isBareJid(String jid); static String escapeLocalpart(String localpart); static String unescapeLocalpart(String localpart); static String completeJidFrom(CharSequence localpart, CharSequence domainpart); static String completeJidFrom(String localpart, String domainpart); static String completeJidFrom(CharSequence localpart, CharSequence domainpart, CharSequence resource); static String completeJidFrom(String localpart, String domainpart, String resource); static String generateKey(String element, String namespace);  }### Answer:
@Test public void parseResource() { final String error = "Error parsing resource"; assertEquals(error, null, XmppStringUtils.parseResource("foo.jxmpp.org")); assertEquals(error, "registered", XmppStringUtils.parseResource("foo.jxmpp.org/registered")); assertEquals(error, "registered", XmppStringUtils.parseResource("user@foo.jxmpp.org/registered")); assertEquals(error, null, XmppStringUtils.parseResource("user@foo.jxmpp.org")); assertEquals(error, "", XmppStringUtils.parseResource("@example.org/")); assertEquals(error, "resOne@resTwo", XmppStringUtils.parseResource("user@foo.jxmpp.org/resOne@resTwo")); }