
com.xtremelabs.robolectric.shadows.ShadowTextUtils Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of robolectric Show documentation
Show all versions of robolectric Show documentation
An alternative Android testing framework.
package com.xtremelabs.robolectric.shadows;
import android.text.TextUtils;
import com.xtremelabs.robolectric.internal.Implementation;
import com.xtremelabs.robolectric.internal.Implements;
/**
* Shadow for the {@code TextUtils} class that implements the {@link #expandTemplate(CharSequence, CharSequence...)}
* method.
*/
@SuppressWarnings({"UnusedDeclaration"})
@Implements(TextUtils.class)
public class ShadowTextUtils {
@Implementation
public static CharSequence expandTemplate(CharSequence template,
CharSequence... values) {
String s = template.toString();
for (int i = 0, valuesLength = values.length; i < valuesLength; i++) {
CharSequence value = values[i];
s = s.replace("^" + (i + 1), value);
}
return s;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy