### Question:
ViewExportedVariablesServlet extends HttpServlet { @VisibleForTesting static SetMultimap<String, Integer> buildAlphanumericNGramIndex(final List<Variable> varList, final int n) { final TreeMultimap<String, Integer> nGramIndex = TreeMultimap.create(); IntStream .range(0, varList.size()) .forEach(i -> alphanumericNGrams(varList.get(i).getName(), n) .forEach(ngram -> nGramIndex.put(ngram, i)) ); return nGramIndex; }  @Override void init(final ServletConfig servletConfig);  }### Answer:
@Test public void buildAlphaNumericNGramIndex() { final TreeMultimap<String, Integer> expectedTriGramIndex = TreeMultimap.create(); expectedTriGramIndex.put("abc", 0); expectedTriGramIndex.put("bcd", 0); expectedTriGramIndex.put("bcd", 1); expectedTriGramIndex.put("zzz", 2); final SetMultimap<String, Integer> actualTriGramIndex = ViewExportedVariablesServlet.buildAlphanumericNGramIndex( Arrays.asList( ManagedVariable.builder().setName("abcd").build(), ManagedVariable.builder().setName("bcd").build(), ManagedVariable.builder().setName("zzz").build() ), 3 ); assertEquals(expectedTriGramIndex, actualTriGramIndex); }