am d77ad190: Fix NPE in a unit test.

* commit 'd77ad1902be50def82596d9c6c84c5fc988444aa':
  Fix NPE in a unit test.
main
Keisuke Kuroyanagi 2013-12-26 00:09:59 -08:00 committed by Android Git Automerger
commit 361cbcfc99
1 changed files with 4 additions and 0 deletions

View File

@ -993,6 +993,10 @@ public class BinaryDictionaryTests extends AndroidTestCase {
for (final String word : words) {
final UnigramProperty unigramProperty = binaryDictionary.getUnigramProperty(word);
assertEquals((int)unigramProbabilities.get(word), unigramProperty.mProbability);
if (!shortcutTargets.containsKey(word)) {
// The word does not have shortcut targets.
continue;
}
assertEquals(shortcutTargets.get(word).size(), unigramProperty.mShortcutTargets.size());
for (final WeightedString shortcutTarget : unigramProperty.mShortcutTargets) {
final String targetCodePonts = shortcutTarget.mWord;