GrandExchangePlugin extends Plugin { @VisibleForTesting static List<Integer> findFuzzyIndices(String term, String query) { List<Integer> indices = new ArrayList<>(); final String termLowerCase = term.toLowerCase(); final String queryLowerCase = query.toLowerCase(); int termIndex = 0; for (int queryIndex = 0; queryIndex < queryLowerCase.length(); queryIndex++) { final char queryChar = queryLowerCase.charAt(queryIndex); boolean termCharacterMatchFound = false; for (; termIndex < termLowerCase.length() && !termCharacterMatchFound; termIndex++) { final char termChar = termLowerCase.charAt(termIndex); if (queryChar == termChar) { indices.add(termIndex); termCharacterMatchFound = true; } } } return indices; }  @Subscribe void onSessionOpen(SessionOpen sessionOpen); @Subscribe void onSessionClose(SessionClose sessionClose); @Subscribe void onConfigChanged(ConfigChanged event); @Subscribe void onGrandExchangeOfferChanged(GrandExchangeOfferChanged offerEvent); @Subscribe void onChatMessage(ChatMessage event); @Subscribe void onGameStateChanged(GameStateChanged gameStateChanged); @Subscribe void onMenuEntryAdded(MenuEntryAdded event); @Subscribe void onFocusChanged(FocusChanged focusChanged); @Subscribe void onWidgetLoaded(WidgetLoaded event); @Subscribe void onScriptPostFired(ScriptPostFired event); @Subscribe void onGrandExchangeSearched(GrandExchangeSearched event); @Subscribe void onScriptCallbackEvent(ScriptCallbackEvent event);  }
@Test public void testFindFuzzyIndices() { List<Integer> fuzzyIndices = findFuzzyIndices("Ancestral robe bottom", "obby"); assertEquals(Arrays.asList(11, 12, 15), fuzzyIndices); }