### Question:
SearchMultiplePattern { public String query(String text) { if (text == null || text.length() < len) { return null; } char[] txt = text.toCharArray(); long hash = 0; for (int i = 0; i < txt.length; i++) { if (i >= len) { hash = (hash - base * (txt[i - len] - 'a') + M) % M; } hash = (hash * R + txt[i] - 'a') % M; if (i >= len - 1) { String possible = fingerPrints.get((int) hash); if (possible != null && possible.equals(text.substring(i - len + 1, i + 1))) { return possible; } } } return null; } SearchMultiplePattern(List<String> patterns); String query(String text);  }### Answer:
@Test public void basicTest() { SearchMultiplePattern search = new SearchMultiplePattern(Arrays.asList("abc", "def", "app", "cat")); Assert.assertEquals("abc", search.query("fhasjkfhabcqwe")); Assert.assertEquals("def", search.query("fhadefghabcqwe")); Assert.assertEquals("app", search.query("fhappfashabcqwe")); Assert.assertEquals("cat", search.query("fhasjkfhabqwecat")); }