diff options
author | 2018-07-06 10:10:54 -0700 | |
---|---|---|
committer | 2018-07-06 10:10:54 -0700 | |
commit | d3b93cc95061ada6a162d7989e313f818e6d4e15 (patch) | |
tree | a4e3eaee6b84d20817d82b2a263e0e47bcc98753 /tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java | |
parent | a497886dda70bbd401652560d11d8f4010985e96 (diff) | |
download | latinime-d3b93cc95061ada6a162d7989e313f818e6d4e15.tar.gz latinime-d3b93cc95061ada6a162d7989e313f818e6d4e15.tar.xz latinime-d3b93cc95061ada6a162d7989e313f818e6d4e15.zip |
Migrate to Android Testing Support Lib (part 5/N)
This CL converts 19 test classes under com.android.inputmethod.latin
to Android Testing Support Library.
Bug: 110805255
Test: verified as follows. No new test failures.
tapas adb LatinIME LatinIMETests arm64 userdebug && \
DISABLE_PROGUARD=true make -j LatinIME && \
adb install -r $OUT/system/app/LatinIME/LatinIME.apk && \
atest LatinIMETests:com.android.inputmethod.latin
Change-Id: I878fcae0126f57c43a644af341e5a0a8ac8f5cc9
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java')
-rw-r--r-- | tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java b/tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java index d465ce674..967b17f09 100644 --- a/tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java +++ b/tests/src/com/android/inputmethod/latin/SuggestedWordsTests.java @@ -16,16 +16,24 @@ package com.android.inputmethod.latin; -import android.test.AndroidTestCase; -import android.test.suitebuilder.annotation.SmallTest; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; + +import android.support.test.filters.SmallTest; +import android.support.test.runner.AndroidJUnit4; import com.android.inputmethod.latin.SuggestedWords.SuggestedWordInfo; +import org.junit.Test; +import org.junit.runner.RunWith; + import java.util.ArrayList; import java.util.Locale; @SmallTest -public class SuggestedWordsTests extends AndroidTestCase { +@RunWith(AndroidJUnit4.class) +public class SuggestedWordsTests { /** * Helper method to create a dummy {@link SuggestedWordInfo} with specifying @@ -80,30 +88,35 @@ public class SuggestedWordsTests extends AndroidTestCase { return returnedWordInfo; } + @Test public void testRemoveDupesNoDupes() { final ArrayList<SuggestedWordInfo> infos = createCorrectionWordInfos("a", "c"); assertEquals(-1, SuggestedWordInfo.removeDups("b", infos)); assertEquals(2, infos.size()); } + @Test public void testRemoveDupesTypedWordNotDupe() { final ArrayList<SuggestedWordInfo> infos = createCorrectionWordInfos("a", "a", "c"); assertEquals(-1, SuggestedWordInfo.removeDups("b", infos)); assertEquals(2, infos.size()); } + @Test public void testRemoveDupesTypedWordOnlyDupe() { final ArrayList<SuggestedWordInfo> infos = createCorrectionWordInfos("a", "b", "c"); assertEquals(1, SuggestedWordInfo.removeDups("b", infos)); assertEquals(2, infos.size()); } + @Test public void testRemoveDupesTypedWordNotOnlyDupe() { final ArrayList<SuggestedWordInfo> infos = createCorrectionWordInfos("a", "b", "b", "c"); assertEquals(1, SuggestedWordInfo.removeDups("b", infos)); assertEquals(2, infos.size()); } + @Test public void testGetTransformedSuggestedWordInfo() { SuggestedWordInfo result = transformWordInfo("word", 0); assertEquals(result.mWord, "word"); @@ -119,6 +132,7 @@ public class SuggestedWordsTests extends AndroidTestCase { assertEquals(result.mWord, "didn't''"); } + @Test public void testGetTypedWordInfoOrNull() { final String TYPED_WORD = "typed"; final SuggestedWordInfo TYPED_WORD_INFO = createTypedWordInfo(TYPED_WORD); |