Fix: NPE in unit test.
Change-Id: I769b43f2afa1151d5c0d9c408018c3932be377dc
This commit is contained in:
parent
80861cde9d
commit
2522a4a477
1 changed files with 10 additions and 8 deletions
|
@ -1237,15 +1237,17 @@ public class BinaryDictionaryTests extends AndroidTestCase {
|
|||
wordSet.remove(word0);
|
||||
final HashSet<String> bigramWord1s = bigrams.get(word0);
|
||||
// TODO: Support ngram.
|
||||
for (final WeightedString bigramTarget : wordProperty.getBigrams()) {
|
||||
final String word1 = bigramTarget.mWord;
|
||||
assertTrue(bigramWord1s.contains(word1));
|
||||
final Pair<String, String> bigram = new Pair<>(word0, word1);
|
||||
if (canCheckBigramProbability(formatVersion)) {
|
||||
final int bigramProbability = bigramProbabilitiesToCheckLater.get(bigram);
|
||||
assertEquals(bigramProbability, bigramTarget.getProbability());
|
||||
if (wordProperty.mHasNgrams) {
|
||||
for (final WeightedString bigramTarget : wordProperty.getBigrams()) {
|
||||
final String word1 = bigramTarget.mWord;
|
||||
assertTrue(bigramWord1s.contains(word1));
|
||||
final Pair<String, String> bigram = new Pair<>(word0, word1);
|
||||
if (canCheckBigramProbability(formatVersion)) {
|
||||
final int bigramProbability = bigramProbabilitiesToCheckLater.get(bigram);
|
||||
assertEquals(bigramProbability, bigramTarget.getProbability());
|
||||
}
|
||||
bigramSet.remove(bigram);
|
||||
}
|
||||
bigramSet.remove(bigram);
|
||||
}
|
||||
token = result.mNextToken;
|
||||
} while (token != 0);
|
||||
|
|
Loading…
Reference in a new issue