### Question:
StringUtil { public static URLInfo getInfo(String encoded) { String target = StringUtil.splitURL(decodeFilenameSafe(encoded))[4]; URLInfo info = new URLInfo(); if (target.indexOf("-") > -1 && !target.endsWith("-l10n") && !target.endsWith("-rpm")) { String[] _tmp = target.split("-"); String[] _tmp2 = new String[_tmp.length-1]; System.arraycopy(_tmp, 0, _tmp2, 0, _tmp2.length); info.setProject(StringUtil.join(_tmp2, "-")); info.setListType(_tmp[_tmp.length-1]); } else { info.setProject(target); info.setListType(null); } return info; }  static String decodeFilenameSafe(String encoded); static URLInfo getInfo(String encoded); static String getProjectName(String mailListName, String mailListCategory);  }### Answer:
@Test public void shouldYieldEmptyListTypeFor_jboss_l10n() { String madeUpUrlForTest = "aHR0cDovL2xpc3RzLmpib3NzLm9yZy9waXBlcm1haWwvamJvc3MtbDEwbi8yMDA5LU1hcmNoLzAwMDAwNy5odG1s"; StringUtil.URLInfo info = StringUtil.getInfo(madeUpUrlForTest); assertEquals(info.getProject(), "jboss-l10n"); assertEquals(info.getListType(), null); }
@Test public void shouldYieldEmptyListTypeFor_jboss_rpm() { String madeUpUrlForTest = "aHR0cDovL2xpc3RzLmpib3NzLm9yZy9waXBlcm1haWwvamJvc3MtcnBtLzIwMTItSnVuZS8wMDAwOTAuaHRtbA=="; StringUtil.URLInfo info = StringUtil.getInfo(madeUpUrlForTest); assertEquals(info.getProject(), "jboss-rpm"); assertEquals(info.getListType(), null); }
@Test public void shouldFailOnIncorrectFileName() { try { String madeUpUrlForTest = ".xx"; StringUtil.URLInfo info = StringUtil.getInfo(madeUpUrlForTest); fail("java.lang.ArrayIndexOutOfBoundsException should have been thrown"); } catch (ArrayIndexOutOfBoundsException e) { } }
@Test public void shouldParseLuceneMailListEntry() { String messageFromLuceneML = "aHR0cDovL21haWwtYXJjaGl2ZXMuYXBhY2hlLm9yZy9tb2RfbWJveC9sdWNlbmUtamF2YS11c2Vy\n" + "LzIwMTAwMy5tYm94LyUzQzhjNGU2ODYxMTAwMzA1MDE0Mm5mYWE2N2NqMzg0Y2QyYjNiZmFhZWI3\n" + "NyU0MG1haWwuZ21haWwuY29tJTNF"; StringUtil.URLInfo info = StringUtil.getInfo(messageFromLuceneML); assertEquals("lucene-java", info.getProject()); assertEquals("user", info.getListType()); }