am 82e87f4f: Merge "Fix: NPE in unit test."

* commit '82e87f4f7fee9e93ff908c1117698c2add460aec':
  Fix: NPE in unit test.
This commit is contained in:
Keisuke Kuroyanagi 2014-10-03 11:03:37 +00:00 committed by Android Git Automerger
commit 829e3a6b00

View file

@ -1237,15 +1237,17 @@ public class BinaryDictionaryTests extends AndroidTestCase {
wordSet.remove(word0); wordSet.remove(word0);
final HashSet<String> bigramWord1s = bigrams.get(word0); final HashSet<String> bigramWord1s = bigrams.get(word0);
// TODO: Support ngram. // TODO: Support ngram.
for (final WeightedString bigramTarget : wordProperty.getBigrams()) { if (wordProperty.mHasNgrams) {
final String word1 = bigramTarget.mWord; for (final WeightedString bigramTarget : wordProperty.getBigrams()) {
assertTrue(bigramWord1s.contains(word1)); final String word1 = bigramTarget.mWord;
final Pair<String, String> bigram = new Pair<>(word0, word1); assertTrue(bigramWord1s.contains(word1));
if (canCheckBigramProbability(formatVersion)) { final Pair<String, String> bigram = new Pair<>(word0, word1);
final int bigramProbability = bigramProbabilitiesToCheckLater.get(bigram); if (canCheckBigramProbability(formatVersion)) {
assertEquals(bigramProbability, bigramTarget.getProbability()); final int bigramProbability = bigramProbabilitiesToCheckLater.get(bigram);
assertEquals(bigramProbability, bigramTarget.getProbability());
}
bigramSet.remove(bigram);
} }
bigramSet.remove(bigram);
} }
token = result.mNextToken; token = result.mNextToken;
} while (token != 0); } while (token != 0);