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
This commit is contained in:
Yohei Yukawa 2014-07-04 18:56:14 +09:00
parent 3895d7f8dc
commit 73065b778c
2 changed files with 0 additions and 67 deletions

View file

@ -75,31 +75,6 @@ public final class StringUtils {
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)) {

View file

@ -56,48 +56,6 @@ public class StringAndJsonUtilsTests extends AndroidTestCase {
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", ""));