### Question:
StringUtil { public static boolean containsAtMostOnce(String str, String searchStr) { if (StringUtils.isBlank(str) || StringUtils.isBlank(searchStr)) { return false; } return StringUtils.indexOf(str, searchStr) == StringUtils.lastIndexOf( str, searchStr); } private  StringUtil(); static List<MediaType> parseMediaTypes(String mediaTypesStr); static MediaType parseMediaType(String mediaTypeStr); static boolean containNonAsciiPrintableChars(String decodeUri); static String generateEncodedRedirectURL(String param,
            String servicePartUri, String baseUrl); static List<String> parseSeparatedStringToListIfListIsNull(
            String separatedStr, List<String> list); static String addQuotas(String str); static boolean checkIsValidSearchPattern(String str); static boolean containsAtMostOnce(String str, String searchStr); static boolean isValidEntityHandleOrName(String handle); static String urlEncode(String str); static String getNormalization(String str); static long parseUnsignedLong(String s); static String foldCase(String strParam); static String foldCaseAndNormalization(String strParam); static List<String> getNotEmptyStringList(List<String> stringList); static final String SPACE; static final String TLD_SPLITOR; static final String ASTERISK; static final String CHAR_SET_UTF8; static final String CHAR_SET_ISO8859; static final int MAX_ENTITY_HANDLE_LENGTH; }### Answer:
@Test public void testContainsMoreThanOnce() throws UnsupportedEncodingException { assertTrue(StringUtil.containsAtMostOnce("bobabc", "o")); assertTrue(StringUtil.containsAtMostOnce("bobabc", "a")); assertTrue(StringUtil.containsAtMostOnce("tobabc", "t")); assertTrue(StringUtil.containsAtMostOnce("bob*", "*")); assertTrue(StringUtil.containsAtMostOnce("*bob", "*")); assertTrue(StringUtil.containsAtMostOnce("b*ob", "*")); assertTrue(StringUtil.containsAtMostOnce("*", "*")); assertTrue(StringUtil.containsAtMostOnce(" * ", "*")); assertFalse(StringUtil.containsAtMostOnce("*b*ob", "*")); assertFalse(StringUtil.containsAtMostOnce("b**ob", "*")); assertFalse(StringUtil.containsAtMostOnce("**", "*")); assertFalse(StringUtil.containsAtMostOnce("**abc", "*")); }