### Question:
StringUtils { public static String getFirstFound(String contents, String regex) { if (isEmpty(regex) || isEmpty(contents)) { return null; } Pattern pattern = Pattern.compile(regex, Pattern.UNICODE_CASE); Matcher matcher = pattern.matcher(contents); if (matcher.find()) { if (matcher.groupCount() > 0) { return matcher.group(1); } else { return matcher.group(); } } return null; } private  StringUtils(); static boolean isEmpty(String str); static Predicate<String> notEmpty(); static boolean isEmpty(List<String> list); static String diff(String str1, String str2); static String getFirstFound(String contents, String regex); static String addDefaultPortIfMissing(String urlString); static String addDefaultPortIfMissing(String urlString, String defaultPort); static String capitalize(String name); static String uncapitalize(String str); static byte[] toBytesUTF8(String str); static byte[] toBytesASCII(String str); static byte[] toBytes(String str, String enc); static String toHexString(byte[] bytes);  }### Answer:
@Test public void testGetFirstFound() throws Exception { String regex = "velocity-\\d+\\.\\d+\\.jar"; assertTrue(StringUtils.isEmpty(StringUtils.getFirstFound("velocity-dep-1.4.jar", regex))); assertFalse(StringUtils.isEmpty(StringUtils.getFirstFound("velocity-1.4.jar", regex))); assertTrue(StringUtils.isEmpty(StringUtils.getFirstFound(null, regex))); }