mirror of
https://gitlab.futo.org/keyboard/latinime.git
synced 2024-09-28 14:54:30 +01:00
am 73065b77: Remove dead code to fix test failure due to NoSuchMethodError
* commit '73065b778c30eecd5913cca5ac42746537dec495': Remove dead code to fix test failure due to NoSuchMethodError
This commit is contained in:
commit
6bcf5fdb5e
@ -75,31 +75,6 @@ public final class StringUtils {
|
|||||||
return containsInArray(text, extraValues.split(SEPARATOR_FOR_COMMA_SPLITTABLE_TEXT));
|
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,
|
public static String removeFromCommaSplittableTextIfExists(final String text,
|
||||||
final String extraValues) {
|
final String extraValues) {
|
||||||
if (TextUtils.isEmpty(extraValues)) {
|
if (TextUtils.isEmpty(extraValues)) {
|
||||||
|
@ -56,48 +56,6 @@ public class StringAndJsonUtilsTests extends AndroidTestCase {
|
|||||||
assertTrue("in 2 elements", StringUtils.containsInCommaSplittableText("key", "key1,key"));
|
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() {
|
public void testRemoveFromCommaSplittableTextIfExists() {
|
||||||
assertEquals("null", "", StringUtils.removeFromCommaSplittableTextIfExists("key", null));
|
assertEquals("null", "", StringUtils.removeFromCommaSplittableTextIfExists("key", null));
|
||||||
assertEquals("empty", "", StringUtils.removeFromCommaSplittableTextIfExists("key", ""));
|
assertEquals("empty", "", StringUtils.removeFromCommaSplittableTextIfExists("key", ""));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user