Code example for TreeMultimap

Methods: getkeySet

0
 
  @Test
  public void testFuzzyMatching() { 
    TreeMultimap<Integer, String> matches = _service.getBestRunIdsForFuzzyId("0102-5");
     
    Integer bestFuzzyDistance = matches.keySet().first();
    Set<String> fuzzyMatches = matches.get(bestFuzzyDistance);
     
    assertTrue("fuzzy matches contain id", fuzzyMatches.contains("X0102-5"));
    assertEquals("fuzzy matches size", 2, fuzzyMatches.size());
    assertEquals("best fuzzy distance not zero: " + bestFuzzyDistance, 0, bestFuzzyDistance.intValue());
     
    matches = _service.getBestRunIdsForFuzzyId("999-75");
     
    bestFuzzyDistance = matches.keySet().first();
    fuzzyMatches = matches.get(bestFuzzyDistance);
     
    assertTrue("fuzzy matches contain id", fuzzyMatches.contains("MISC-YU-75"));
    assertEquals("fuzzy matches size", 1, fuzzyMatches.size());
    assertEquals("best fuzzy distance", 0, bestFuzzyDistance.intValue());