@Test(dataProvider="getAbbreviationsTests") public void testGetAbbreviations(String s, String[] expectedPhrases) { AbbreviationsManager manager = new AbbreviationsManager(defaultProperties); Abbreviations abbrev = manager.getAbbreviations(s); assertEquals(abbrev.getValue(), s); assertEquals(abbrev.getPhrases().size(), expectedPhrases.length); for (int i=0; i<abbrev.getPhrases().size(); ++i) { String phrase = abbrev.getPhrases().get(i); assertEquals(phrase, expectedPhrases[i]); List<String> alternatives = abbrev.getAbbreviations(phrase); List<String> expectedAlternatives = manager.getAlternatives(abbrev.getPhrases().get(i)); assertTrue(alternatives.size() >= 1); assertEquals(alternatives.size(), expectedAlternatives.size()); assertEquals(alternatives.get(0), abbrev.getPhrases().get(i)); } }
public Abbreviations getAbbreviations(String s) { AbbreviationsImpl abbrev = new AbbreviationsImpl(s); List<String> phrases = getPhrasesWithAbbreviations(s); for (String phrase : phrases) { abbrev.addPhrase(phrase, getAlternatives(phrase)); } return abbrev; }
AbbreviationsManager { public Abbreviations getAbbreviations(String s) { AbbreviationsImpl abbrev = new AbbreviationsImpl(s); List<String> phrases = getPhrasesWithAbbreviations(s); for (String phrase : phrases) { abbrev.addPhrase(phrase, getAlternatives(phrase)); } return abbrev; } }
AbbreviationsManager { public Abbreviations getAbbreviations(String s) { AbbreviationsImpl abbrev = new AbbreviationsImpl(s); List<String> phrases = getPhrasesWithAbbreviations(s); for (String phrase : phrases) { abbrev.addPhrase(phrase, getAlternatives(phrase)); } return abbrev; } AbbreviationsManager(Properties abbreviationProperties); }
AbbreviationsManager { public Abbreviations getAbbreviations(String s) { AbbreviationsImpl abbrev = new AbbreviationsImpl(s); List<String> phrases = getPhrasesWithAbbreviations(s); for (String phrase : phrases) { abbrev.addPhrase(phrase, getAlternatives(phrase)); } return abbrev; } AbbreviationsManager(Properties abbreviationProperties); List<String> getAlternatives(String phrase); Abbreviations getAbbreviations(String s); }
AbbreviationsManager { public Abbreviations getAbbreviations(String s) { AbbreviationsImpl abbrev = new AbbreviationsImpl(s); List<String> phrases = getPhrasesWithAbbreviations(s); for (String phrase : phrases) { abbrev.addPhrase(phrase, getAlternatives(phrase)); } return abbrev; } AbbreviationsManager(Properties abbreviationProperties); List<String> getAlternatives(String phrase); Abbreviations getAbbreviations(String s);  }