diff options
author | 2013-12-26 17:01:48 +0900 | |
---|---|---|
committer | 2013-12-26 17:01:48 +0900 | |
commit | d77ad1902be50def82596d9c6c84c5fc988444aa (patch) | |
tree | 06e39b0c9c387e4dc530cfc97553827a1328d9f5 /tests/src/com/android/inputmethod/latin/BinaryDictionaryTests.java | |
parent | 65e3ae6f153a136902eaaf4da217496802c1daa1 (diff) | |
download | latinime-d77ad1902be50def82596d9c6c84c5fc988444aa.tar.gz latinime-d77ad1902be50def82596d9c6c84c5fc988444aa.tar.xz latinime-d77ad1902be50def82596d9c6c84c5fc988444aa.zip |
Fix NPE in a unit test.
Change-Id: I0dfc23232ed77e1ff1aedecfa6ac022020cb1c19
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/BinaryDictionaryTests.java')
-rw-r--r-- | tests/src/com/android/inputmethod/latin/BinaryDictionaryTests.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/src/com/android/inputmethod/latin/BinaryDictionaryTests.java b/tests/src/com/android/inputmethod/latin/BinaryDictionaryTests.java index a26c25886..65c70a6db 100644 --- a/tests/src/com/android/inputmethod/latin/BinaryDictionaryTests.java +++ b/tests/src/com/android/inputmethod/latin/BinaryDictionaryTests.java @@ -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; |