Remove dead code to fix test failure due to NoSuchMethodError
This CL removes following methods from StringUtils, which are
no longer used since Id3c262386a7bc7ed75966b1395a50171abe550d3.
- #joinCommaSplittableText
- #appendToCommaSplittableTextIfNotExists
BUG: 16000850
Change-Id: Ibdc9b7e463a19cdfac788b24c0a6322d0c5850c5
diff --git a/java/src/com/android/inputmethod/latin/utils/StringUtils.java b/java/src/com/android/inputmethod/latin/utils/StringUtils.java
index e4237a7..ceb0383 100644
--- a/java/src/com/android/inputmethod/latin/utils/StringUtils.java
+++ b/java/src/com/android/inputmethod/latin/utils/StringUtils.java
@@ -75,31 +75,6 @@
return containsInArray(text, extraValues.split(SEPARATOR_FOR_COMMA_SPLITTABLE_TEXT));
}
- public static String joinCommaSplittableText(final String head, final String tail) {
- if (TextUtils.isEmpty(head) && TextUtils.isEmpty(tail)) {
- return EMPTY_STRING;
- }
- // Here either head or tail is not null.
- if (TextUtils.isEmpty(head)) {
- return tail;
- }
- if (TextUtils.isEmpty(tail)) {
- return head;
- }
- return head + SEPARATOR_FOR_COMMA_SPLITTABLE_TEXT + tail;
- }
-
- public static String appendToCommaSplittableTextIfNotExists(final String text,
- final String extraValues) {
- if (TextUtils.isEmpty(extraValues)) {
- return text;
- }
- if (containsInCommaSplittableText(text, extraValues)) {
- return extraValues;
- }
- return extraValues + SEPARATOR_FOR_COMMA_SPLITTABLE_TEXT + text;
- }
-
public static String removeFromCommaSplittableTextIfExists(final String text,
final String extraValues) {
if (TextUtils.isEmpty(extraValues)) {
diff --git a/tests/src/com/android/inputmethod/latin/utils/StringAndJsonUtilsTests.java b/tests/src/com/android/inputmethod/latin/utils/StringAndJsonUtilsTests.java
index cd9a983..4448a6b 100644
--- a/tests/src/com/android/inputmethod/latin/utils/StringAndJsonUtilsTests.java
+++ b/tests/src/com/android/inputmethod/latin/utils/StringAndJsonUtilsTests.java
@@ -56,48 +56,6 @@
assertTrue("in 2 elements", StringUtils.containsInCommaSplittableText("key", "key1,key"));
}
- public void testJoinCommaSplittableText() {
- assertEquals("2 nulls", "",
- StringUtils.joinCommaSplittableText(null, null));
- assertEquals("null and empty", "",
- StringUtils.joinCommaSplittableText(null, ""));
- assertEquals("empty and null", "",
- StringUtils.joinCommaSplittableText("", null));
- assertEquals("2 empties", "",
- StringUtils.joinCommaSplittableText("", ""));
- assertEquals("text and null", "text",
- StringUtils.joinCommaSplittableText("text", null));
- assertEquals("text and empty", "text",
- StringUtils.joinCommaSplittableText("text", ""));
- assertEquals("null and text", "text",
- StringUtils.joinCommaSplittableText(null, "text"));
- assertEquals("empty and text", "text",
- StringUtils.joinCommaSplittableText("", "text"));
- assertEquals("2 texts", "text1,text2",
- StringUtils.joinCommaSplittableText("text1", "text2"));
- }
-
- public void testAppendToCommaSplittableTextIfNotExists() {
- assertEquals("null", "key",
- StringUtils.appendToCommaSplittableTextIfNotExists("key", null));
- assertEquals("empty", "key",
- StringUtils.appendToCommaSplittableTextIfNotExists("key", ""));
-
- assertEquals("not in 1 element", "key1,key",
- StringUtils.appendToCommaSplittableTextIfNotExists("key", "key1"));
- assertEquals("not in 2 elements", "key1,key2,key",
- StringUtils.appendToCommaSplittableTextIfNotExists("key", "key1,key2"));
-
- assertEquals("in 1 element", "key",
- StringUtils.appendToCommaSplittableTextIfNotExists("key", "key"));
- assertEquals("in 2 elements at position 1", "key,key2",
- StringUtils.appendToCommaSplittableTextIfNotExists("key", "key,key2"));
- assertEquals("in 2 elements at position 2", "key1,key",
- StringUtils.appendToCommaSplittableTextIfNotExists("key", "key1,key"));
- assertEquals("in 3 elements at position 2", "key1,key,key3",
- StringUtils.appendToCommaSplittableTextIfNotExists("key", "key1,key,key3"));
- }
-
public void testRemoveFromCommaSplittableTextIfExists() {
assertEquals("null", "", StringUtils.removeFromCommaSplittableTextIfExists("key", null));
assertEquals("empty", "", StringUtils.removeFromCommaSplittableTextIfExists("key", ""));