@Test public void testGetAlternatives() { AbbreviationsManager manager; Properties props; List<String> alternatives; props = new Properties(); manager = new AbbreviationsManager(props); alternatives = manager.getAlternatives("volts"); assertEquals(alternatives.size(), 1); assertEquals(alternatives.get(0), "volts"); props = new Properties(); props.setProperty("Volts", "V"); manager = new AbbreviationsManager(props); alternatives = manager.getAlternatives("volts"); assertEquals(alternatives.size(), 2); assertEquals(alternatives.get(0), "volts"); assertEquals(alternatives.get(1), "V"); props = new Properties(); props.setProperty("Amperes", "Amps | A | aa | bbbb | a | aaaa "); manager = new AbbreviationsManager(props); alternatives = manager.getAlternatives("amperes"); assertEquals(alternatives.size(), 7); assertEquals(alternatives.get(0), "amperes"); assertEquals(alternatives.get(1), "A"); assertEquals(alternatives.get(2), "a"); assertEquals(alternatives.get(3), "aa"); assertEquals(alternatives.get(4), "Amps"); assertEquals(alternatives.get(5), "bbbb"); assertEquals(alternatives.get(6), "aaaa"); }
public List<String> getAlternatives(String phrase) { List<String> result = new ArrayList<String>(); result.add(phrase); List<String> alternatives = abbreviations.get(phrase.toLowerCase()); if (alternatives != null) { result.addAll(alternatives); } return result; }
AbbreviationsManager { public List<String> getAlternatives(String phrase) { List<String> result = new ArrayList<String>(); result.add(phrase); List<String> alternatives = abbreviations.get(phrase.toLowerCase()); if (alternatives != null) { result.addAll(alternatives); } return result; } }
AbbreviationsManager { public List<String> getAlternatives(String phrase) { List<String> result = new ArrayList<String>(); result.add(phrase); List<String> alternatives = abbreviations.get(phrase.toLowerCase()); if (alternatives != null) { result.addAll(alternatives); } return result; } AbbreviationsManager(Properties abbreviationProperties); }
AbbreviationsManager { public List<String> getAlternatives(String phrase) { List<String> result = new ArrayList<String>(); result.add(phrase); List<String> alternatives = abbreviations.get(phrase.toLowerCase()); if (alternatives != null) { result.addAll(alternatives); } return result; } AbbreviationsManager(Properties abbreviationProperties); List<String> getAlternatives(String phrase); Abbreviations getAbbreviations(String s); }
AbbreviationsManager { public List<String> getAlternatives(String phrase) { List<String> result = new ArrayList<String>(); result.add(phrase); List<String> alternatives = abbreviations.get(phrase.toLowerCase()); if (alternatives != null) { result.addAll(alternatives); } return result; } AbbreviationsManager(Properties abbreviationProperties); List<String> getAlternatives(String phrase); Abbreviations getAbbreviations(String s);  }