### Question:
UserSearchUtils { public static Pattern createSearchPattern(String input, boolean caseSensitive) { int options = 0; if (!caseSensitive) { options |= Pattern.CASE_INSENSITIVE; } Pattern p = createPattern(input, true, options); return p; }  static Pattern createSearchPattern(String input, boolean caseSensitive); static Pattern createLiteralSearchPattern(String text); static Pattern createStartsWithPattern(String input, boolean allowGlobbing,
			int options); static Pattern createEndsWithPattern(String input, boolean allowGlobbing, int options); static Pattern createContainsPattern(String input, boolean allowGlobbing, int options); static Pattern createPattern(String input, boolean allowGlobbing, int options); static String createPatternString(String input, boolean allowGlobbing); final static String STAR; final static Pattern NON_GLOB_BACKSLASH_PATTERN; }### Answer:
@Test public void testCreateSearchPatternCaseSenstive() { Pattern pattern = UserSearchUtils.createSearchPattern("b?b?", true); assertFalse(pattern.matcher("b").matches()); assertFalse(pattern.matcher("bb").matches()); assertFalse(pattern.matcher("bob").matches()); assertFalse(pattern.matcher("xbob").matches()); assertFalse(pattern.matcher("boBx").matches()); assertTrue(pattern.matcher("bobx").matches()); }
@Test public void testCreateSearchPatternCaseInsenstive() { Pattern pattern = UserSearchUtils.createSearchPattern("b?b?", false); assertFalse(pattern.matcher("b").matches()); assertFalse(pattern.matcher("bb").matches()); assertFalse(pattern.matcher("bob").matches()); assertFalse(pattern.matcher("xbob").matches()); assertTrue(pattern.matcher("boBx").matches()); assertTrue(pattern.matcher("bobx").matches()); }
@Test public void testCreateSearchPatternCaseInsenstive_ContainsNonGlobbingRegexChar() { Pattern pattern = UserSearchUtils.createSearchPattern("Bob[*", false); assertFalse(pattern.matcher("b").matches()); assertFalse(pattern.matcher("bob").matches()); assertFalse(pattern.matcher("bobb[").matches()); assertTrue(pattern.matcher("bob[").matches()); assertTrue(pattern.matcher("Bob[").matches()); assertTrue(pattern.matcher("Bob[2]").matches()); }