aboutsummaryrefslogtreecommitdiffstats
path: root/tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java
diff options
context:
space:
mode:
authorYohei Yukawa <yukawa@google.com>2018-07-05 13:45:04 -0700
committerYohei Yukawa <yukawa@google.com>2018-07-05 13:45:04 -0700
commit9c49581eeb96ebf6ca4dc2110ea986d784c48912 (patch)
tree403e5d84a56be67fa3a8bb17864322e8a2d393b5 /tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java
parent2802250415af3bfe57bab6826966a35f75a4ec86 (diff)
downloadlatinime-9c49581eeb96ebf6ca4dc2110ea986d784c48912.tar.gz
latinime-9c49581eeb96ebf6ca4dc2110ea986d784c48912.tar.xz
latinime-9c49581eeb96ebf6ca4dc2110ea986d784c48912.zip
Migrate to Android Testing Support Lib (part 1/N)
This CL converts tests under com.android.inputmethod.latin.utils 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.utils Change-Id: I5cc2ddbc4116003ab6407432ab521b6b560052ae
Diffstat (limited to 'tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java')
-rw-r--r--tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java
index 0cbb02c4f..96dfa36c2 100644
--- a/tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/CollectionUtilsTests.java
@@ -16,11 +16,16 @@
package com.android.inputmethod.latin.utils;
-import android.test.AndroidTestCase;
-import android.test.suitebuilder.annotation.SmallTest;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
import com.android.inputmethod.latin.common.CollectionUtils;
+import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -28,15 +33,20 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
/**
* Tests for {@link CollectionUtils}.
*/
@SmallTest
-public class CollectionUtilsTests extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public class CollectionUtilsTests {
/**
* Tests that {@link CollectionUtils#arrayAsList(Object[],int,int)} fails as expected
* with some invalid inputs.
*/
+ @Test
public void testArrayAsListFailure() {
final String[] array = { "0", "1" };
// Negative start
@@ -66,6 +76,7 @@ public class CollectionUtilsTests extends AndroidTestCase {
* Tests that {@link CollectionUtils#arrayAsList(Object[],int,int)} gives the expected
* results for a few valid inputs.
*/
+ @Test
public void testArrayAsList() {
final ArrayList<String> empty = new ArrayList<>();
assertEquals(empty, CollectionUtils.arrayAsList(new String[] {}, 0, 0));
@@ -81,6 +92,7 @@ public class CollectionUtilsTests extends AndroidTestCase {
* Tests that {@link CollectionUtils#isNullOrEmpty(java.util.Collection)} gives the expected
* results for a few cases.
*/
+ @Test
public void testIsNullOrEmpty() {
assertTrue(CollectionUtils.isNullOrEmpty((List<String>) null));
assertTrue(CollectionUtils.isNullOrEmpty((Map<String, String>) null));