@Test public void testMultipleKeyExtraction() { final VocabularyServiceImpl vocab = new VocabularyServiceImpl(mock(EntityManagerImpl.class), mock(StrongAugmentationService.class)); final String[] keys = vocab.getKeys("strong:G16,strong:G09"); assertEquals("G0016", keys[0]); assertEquals("G0009", keys[1]); }
String[] getKeys(final String vocabIdentifiers) { if (isBlank(vocabIdentifiers)) { return new String[0]; } final String[] ids = vocabIdentifiers.split(STRONG_SEPARATORS); for (int ii = 0; ii < ids.length; ii++) { final char firstChar = ids[ii].charAt(0); if (firstChar == 'G' || firstChar == 'H') { ids[ii] = padStrongNumber(ids[ii], false); } else if ((ids[ii].startsWith(HIGHER_STRONG) || ids[ii].startsWith(LOWER_STRONG)) && ids[ii].length() > START_STRONG_KEY) { ids[ii] = padStrongNumber(ids[ii].substring(START_STRONG_KEY), false); } } return ids; }
VocabularyServiceImpl implements VocabularyService { String[] getKeys(final String vocabIdentifiers) { if (isBlank(vocabIdentifiers)) { return new String[0]; } final String[] ids = vocabIdentifiers.split(STRONG_SEPARATORS); for (int ii = 0; ii < ids.length; ii++) { final char firstChar = ids[ii].charAt(0); if (firstChar == 'G' || firstChar == 'H') { ids[ii] = padStrongNumber(ids[ii], false); } else if ((ids[ii].startsWith(HIGHER_STRONG) || ids[ii].startsWith(LOWER_STRONG)) && ids[ii].length() > START_STRONG_KEY) { ids[ii] = padStrongNumber(ids[ii].substring(START_STRONG_KEY), false); } } return ids; } }
VocabularyServiceImpl implements VocabularyService { String[] getKeys(final String vocabIdentifiers) { if (isBlank(vocabIdentifiers)) { return new String[0]; } final String[] ids = vocabIdentifiers.split(STRONG_SEPARATORS); for (int ii = 0; ii < ids.length; ii++) { final char firstChar = ids[ii].charAt(0); if (firstChar == 'G' || firstChar == 'H') { ids[ii] = padStrongNumber(ids[ii], false); } else if ((ids[ii].startsWith(HIGHER_STRONG) || ids[ii].startsWith(LOWER_STRONG)) && ids[ii].length() > START_STRONG_KEY) { ids[ii] = padStrongNumber(ids[ii].substring(START_STRONG_KEY), false); } } return ids; } @Inject  VocabularyServiceImpl(final EntityManager manager,
                                 final StrongAugmentationService strongAugmentationService); }
VocabularyServiceImpl implements VocabularyService { String[] getKeys(final String vocabIdentifiers) { if (isBlank(vocabIdentifiers)) { return new String[0]; } final String[] ids = vocabIdentifiers.split(STRONG_SEPARATORS); for (int ii = 0; ii < ids.length; ii++) { final char firstChar = ids[ii].charAt(0); if (firstChar == 'G' || firstChar == 'H') { ids[ii] = padStrongNumber(ids[ii], false); } else if ((ids[ii].startsWith(HIGHER_STRONG) || ids[ii].startsWith(LOWER_STRONG)) && ids[ii].length() > START_STRONG_KEY) { ids[ii] = padStrongNumber(ids[ii].substring(START_STRONG_KEY), false); } } return ids; } @Inject  VocabularyServiceImpl(final EntityManager manager,
                                 final StrongAugmentationService strongAugmentationService); static String padStrongNumber(final String strongNumber, final boolean prefix); @Override VocabResponse getDefinitions(final String version, final String reference, final String vocabIdentifiers, final String userLanguage); @Override VocabResponse getQuickDefinitions(final String version, final String reference, final String vocabIdentifiers, final String userLanguage); @Override String getTransliteration(final String originalText); @Override String getEnglishVocab(final String version, final String reference, final String vocabIdentifiers); @Override String get_zh_tw_Vocab(final String version, final String reference, final String vocabIdentifiers); @Override String get_zh_Vocab(final String version, final String reference, final String vocabIdentifiers); @Override String getGreekVocab(final String version, final String reference, final String vocabIdentifiers); @Override String getDefaultTransliteration(final String version, final String reference, final String vocabIdentifiers); @Override synchronized EntityDoc[] getLexiconDefinitions(final String vocabIdentifiers, final String version, final String reference); }
VocabularyServiceImpl implements VocabularyService { String[] getKeys(final String vocabIdentifiers) { if (isBlank(vocabIdentifiers)) { return new String[0]; } final String[] ids = vocabIdentifiers.split(STRONG_SEPARATORS); for (int ii = 0; ii < ids.length; ii++) { final char firstChar = ids[ii].charAt(0); if (firstChar == 'G' || firstChar == 'H') { ids[ii] = padStrongNumber(ids[ii], false); } else if ((ids[ii].startsWith(HIGHER_STRONG) || ids[ii].startsWith(LOWER_STRONG)) && ids[ii].length() > START_STRONG_KEY) { ids[ii] = padStrongNumber(ids[ii].substring(START_STRONG_KEY), false); } } return ids; } @Inject  VocabularyServiceImpl(final EntityManager manager,
                                 final StrongAugmentationService strongAugmentationService); static String padStrongNumber(final String strongNumber, final boolean prefix); @Override VocabResponse getDefinitions(final String version, final String reference, final String vocabIdentifiers, final String userLanguage); @Override VocabResponse getQuickDefinitions(final String version, final String reference, final String vocabIdentifiers, final String userLanguage); @Override String getTransliteration(final String originalText); @Override String getEnglishVocab(final String version, final String reference, final String vocabIdentifiers); @Override String get_zh_tw_Vocab(final String version, final String reference, final String vocabIdentifiers); @Override String get_zh_Vocab(final String version, final String reference, final String vocabIdentifiers); @Override String getGreekVocab(final String version, final String reference, final String vocabIdentifiers); @Override String getDefaultTransliteration(final String version, final String reference, final String vocabIdentifiers); @Override synchronized EntityDoc[] getLexiconDefinitions(final String vocabIdentifiers, final String version, final String reference);  }