package android.text.format;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
-import junit.framework.TestCase;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-public class DateFormatTest extends TestCase {
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class DateFormatTest {
- @SmallTest
- public void testHasDesignator() throws Exception {
+ @Test
+ public void testHasDesignator() {
assertTrue(DateFormat.hasDesignator("hh:mm:ss", DateFormat.MINUTE));
assertTrue(DateFormat.hasDesignator("myyyy", DateFormat.MINUTE));
assertTrue(DateFormat.hasDesignator("mmm", DateFormat.MINUTE));
assertFalse(DateFormat.hasDesignator("hh:MM:ss", DateFormat.MINUTE));
}
- @SmallTest
- public void testHasDesignatorEscaped() throws Exception {
+ @Test
+ public void testHasDesignatorEscaped() {
assertTrue(DateFormat.hasDesignator("hh:mm 'LOL'", DateFormat.MINUTE));
assertFalse(DateFormat.hasDesignator("hh:mm 'yyyy'", DateFormat.YEAR));
package android.text.format;
+import static org.junit.Assert.assertEquals;
+
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.LocaleList;
import android.support.test.filters.SmallTest;
-
-import junit.framework.TestCase;
+import android.support.test.runner.AndroidJUnit4;
import java.util.Locale;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-public class DateUtilsTest extends TestCase {
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class DateUtilsTest {
private static final LocaleList LOCALE_LIST_US = new LocaleList(Locale.US);
private LocaleList mOriginalLocales;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setup() {
mOriginalLocales = Resources.getSystem().getConfiguration().getLocales();
setLocales(LOCALE_LIST_US);
}
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void teardown() {
setLocales(mOriginalLocales);
- super.tearDown();
- }
-
- private void setLocales(LocaleList locales) {
- final Resources systemResources = Resources.getSystem();
- final Configuration config = new Configuration(systemResources.getConfiguration());
- config.setLocales(locales);
- // This is not very safe to call, but since DateUtils.formatDuration() is a static method
- // (it gets its format strings from the system resources), we can't pass a modified Context
- // to it.
- systemResources.updateConfiguration(config, null);
}
- @SmallTest
- public void test_formatDuration_seconds() throws Exception {
+ @Test
+ public void test_formatDuration_seconds() {
assertEquals("0 seconds", DateUtils.formatDuration(0));
assertEquals("0 seconds", DateUtils.formatDuration(1));
assertEquals("0 seconds", DateUtils.formatDuration(499));
assertEquals("2s", DateUtils.formatDuration(1500, DateUtils.LENGTH_SHORTEST));
}
- @SmallTest
- public void test_formatDuration_Minutes() throws Exception {
+ @Test
+ public void test_formatDuration_Minutes() {
assertEquals("59 seconds", DateUtils.formatDuration(59000));
assertEquals("60 seconds", DateUtils.formatDuration(59500));
assertEquals("1 minute", DateUtils.formatDuration(60000));
assertEquals("2m", DateUtils.formatDuration(120000, DateUtils.LENGTH_SHORTEST));
}
- @SmallTest
- public void test_formatDuration_Hours() throws Exception {
+ @Test
+ public void test_formatDuration_Hours() {
assertEquals("59 minutes", DateUtils.formatDuration(3540000));
assertEquals("1 hour", DateUtils.formatDuration(3600000));
assertEquals("48 hours", DateUtils.formatDuration(172800000));
assertEquals("1h", DateUtils.formatDuration(3600000, DateUtils.LENGTH_SHORTEST));
assertEquals("48h", DateUtils.formatDuration(172800000, DateUtils.LENGTH_SHORTEST));
}
+
+ private void setLocales(LocaleList locales) {
+ final Resources systemResources = Resources.getSystem();
+ final Configuration config = new Configuration(systemResources.getConfiguration());
+ config.setLocales(locales);
+ // This is not very safe to call, but since DateUtils.formatDuration() is a static method
+ // (it gets its format strings from the system resources), we can't pass a modified Context
+ // to it.
+ systemResources.updateConfiguration(config, null);
+ }
+
}
package android.text.format;
+import static org.junit.Assert.assertEquals;
+
+import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
+import android.support.test.InstrumentationRegistry;
import android.support.test.filters.SmallTest;
-import android.test.AndroidTestCase;
+import android.support.test.runner.AndroidJUnit4;
import android.text.format.Formatter.BytesResult;
import java.util.Locale;
-
-public class FormatterTest extends AndroidTestCase {
-
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class FormatterTest {
private Locale mOriginalLocale;
+ private Context mContext;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- mOriginalLocale = mContext.getResources().getConfiguration().locale;
+ @Before
+ public void setup() {
+ mContext = InstrumentationRegistry.getContext();
+ mOriginalLocale = mContext.getResources()
+ .getConfiguration().locale;
}
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void tearDown() {
if (mOriginalLocale != null) {
setLocale(mOriginalLocale);
}
- super.tearDown();
- }
-
- private void setLocale(Locale locale) {
- Resources res = getContext().getResources();
- Configuration config = res.getConfiguration();
- config.locale = locale;
- res.updateConfiguration(config, res.getDisplayMetrics());
-
- Locale.setDefault(locale);
}
- @SmallTest
+ @Test
public void testFormatBytes() {
setLocale(Locale.ENGLISH);
checkFormatBytes(-914, false, "-0.91", -910);
// Missing FLAG_CALCULATE_ROUNDED case.
- BytesResult r = Formatter.formatBytes(getContext().getResources(), 1, 0);
+ BytesResult r = Formatter.formatBytes(mContext.getResources(), 1, 0);
assertEquals("1", r.value);
assertEquals(0, r.roundedBytes); // Didn't pass FLAG_CALCULATE_ROUNDED
private void checkFormatBytes(long bytes, boolean useShort,
String expectedString, long expectedRounded) {
- BytesResult r = Formatter.formatBytes(getContext().getResources(), bytes,
+ BytesResult r = Formatter.formatBytes(mContext.getResources(), bytes,
Formatter.FLAG_CALCULATE_ROUNDED | (useShort ? Formatter.FLAG_SHORTER : 0));
assertEquals(expectedString, r.value);
assertEquals(expectedRounded, r.roundedBytes);
}
+
+ private void setLocale(Locale locale) {
+ Resources res = mContext.getResources();
+ Configuration config = res.getConfiguration();
+ config.locale = locale;
+ res.updateConfiguration(config, res.getDisplayMetrics());
+
+ Locale.setDefault(locale);
+ }
}
package android.text.format;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
import android.support.test.filters.SmallTest;
import android.support.test.filters.Suppress;
+import android.support.test.runner.AndroidJUnit4;
import android.util.Log;
import android.util.TimeFormatException;
-import junit.framework.TestCase;
+import org.junit.Test;
+import org.junit.runner.RunWith;
-public class TimeTest extends TestCase {
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class TimeTest {
- @SmallTest
- public void testNormalize0() throws Exception {
+ @Test
+ public void testNormalize0() {
Time t = new Time(Time.TIMEZONE_UTC);
t.parse("20060432T010203");
t.normalize(false /* use isDst */);
new DateTest(2007, 10, 5, 2, 0, 60, 2007, 10, 5, 3, 0),
};
- @SmallTest
- public void testNormalize1() throws Exception {
+ @Test
+ public void testNormalize1() {
Time local = new Time("America/Los_Angeles");
int len = dayTests.length;
}
}
- @SmallTest
- public void testSwitchTimezone0() throws Exception {
+ @Test
+ public void testSwitchTimezone0() {
Time t = new Time(Time.TIMEZONE_UTC);
t.parse("20061005T120000");
t.switchTimezone("America/Los_Angeles");
// System.out.println("got: " + t);
}
- @SmallTest
- public void testCtor0() throws Exception {
+ @Test
+ public void testCtor0() {
Time t = new Time(Time.TIMEZONE_UTC);
assertEquals(Time.TIMEZONE_UTC, t.timezone);
}
- @SmallTest
- public void testGetActualMaximum0() throws Exception {
+ @Test
+ public void testGetActualMaximum0() {
Time t = new Time(Time.TIMEZONE_UTC);
- int r = t.getActualMaximum(Time.SECOND);
+ t.getActualMaximum(Time.SECOND);
// System.out.println("r=" + r);
}
- @SmallTest
- public void testClear0() throws Exception {
+ @Test
+ public void testClear0() {
Time t = new Time(Time.TIMEZONE_UTC);
t.clear(Time.TIMEZONE_UTC);
}
- @SmallTest
- public void testCompare0() throws Exception {
+ @Test
+ public void testCompare0() {
Time a = new Time(Time.TIMEZONE_UTC);
Time b = new Time("America/Los_Angeles");
int r = Time.compare(a, b);
// System.out.println("r=" + r);
}
- @SmallTest
- public void testFormat0() throws Exception {
+ @Test
+ public void testFormat0() {
Time t = new Time(Time.TIMEZONE_UTC);
String r = t.format("%Y%m%dT%H%M%S");
// System.out.println("r='" + r + "'");
}
- @SmallTest
- public void testToString0() throws Exception {
+ @Test
+ public void testToString0() {
Time t = new Time(Time.TIMEZONE_UTC);
String r = t.toString();
// System.out.println("r='" + r + "'");
}
- @SmallTest
- public void testGetCurrentTimezone0() throws Exception {
+ @Test
+ public void testGetCurrentTimezone0() {
String r = Time.getCurrentTimezone();
// System.out.println("r='" + r + "'");
}
- @SmallTest
- public void testSetToNow0() throws Exception {
+ @Test
+ public void testSetToNow0() {
Time t = new Time(Time.TIMEZONE_UTC);
t.setToNow();
// System.out.println("t=" + t);
}
- @SmallTest
- public void testMillis0() throws Exception {
+ @Test
+ public void testMillis0() {
Time t = new Time(Time.TIMEZONE_UTC);
t.set(0, 0, 0, 1, 1, 2006);
long r = t.toMillis(true /* ignore isDst */);
// System.out.println("r=" + r);
}
- @SmallTest
- public void testMillis1() throws Exception {
+ @Test
+ public void testMillis1() {
Time t = new Time(Time.TIMEZONE_UTC);
t.set(1, 0, 0, 1, 0, 1970);
long r = t.toMillis(true /* ignore isDst */);
// System.out.println("r=" + r);
}
- @SmallTest
- public void testParse0() throws Exception {
+ @Test
+ public void testParse0() {
Time t = new Time(Time.TIMEZONE_UTC);
t.parse("12345678T901234");
// System.out.println("t=" + t);
}
- @SmallTest
- public void testParse33390() throws Exception {
+ @Test
+ public void testParse33390() {
Time t = new Time(Time.TIMEZONE_UTC);
t.parse3339("1980-05-23");
}
}
- @SmallTest
- public void testSet0() throws Exception {
+ @Test
+ public void testSet0() {
Time t = new Time(Time.TIMEZONE_UTC);
t.set(1000L);
// System.out.println("t.year=" + t.year);
// System.out.println("t=" + t);
}
- @SmallTest
- public void testSet1() throws Exception {
+ @Test
+ public void testSet1() {
Time t = new Time(Time.TIMEZONE_UTC);
t.set(1, 2, 3, 4, 5, 6);
// System.out.println("t=" + t);
}
-
+
// Timezones that cover the world. Some GMT offsets occur more than
// once in case some cities decide to change their GMT offset.
private static final String[] mTimeZones = {
"Pacific/Honolulu",
"Pacific/Midway",
};
-
+
@Suppress
- public void disableTestGetJulianDay() throws Exception {
+ public void disableTestGetJulianDay() {
Time time = new Time();
// For each day of the year, and for each timezone, get the Julian
}
}
}
-
+
@Suppress
- public void disableTestSetJulianDay() throws Exception {
+ public void disableTestSetJulianDay() {
Time time = new Time();
-
+
// For each day of the year in 2008, and for each timezone,
// test that we can set the Julian day correctly.
for (int monthDay = 1; monthDay <= 366; monthDay++) {
package android.text.method;
import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
import android.text.InputType;
import android.view.KeyEvent;
import android.widget.TextView.BufferType;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* Test backspace key handling of {@link android.text.method.BaseKeyListener}.
* Only contains edge cases. For normal cases, see {@see android.text.method.cts.BackspaceTest}.
* TODO: introduce test cases for surrogate pairs and replacement span.
*/
+@SmallTest
+@RunWith(AndroidJUnit4.class)
public class BackspaceTest extends KeyListenerTestCase {
private static final BaseKeyListener mKeyListener = new BaseKeyListener() {
public int getInputType() {
state.mSelectionEnd = mTextView.getSelectionEnd();
}
- @SmallTest
+ @Test
public void testCombiningEnclosingKeycaps() {
EditorState state = new EditorState();
state.assertEquals("|");
}
- @SmallTest
+ @Test
public void testVariationSelector() {
EditorState state = new EditorState();
state.assertEquals("|");
}
- @SmallTest
+ @Test
public void testEmojiZWJSequence() {
EditorState state = new EditorState();
state.assertEquals("|");
}
- @SmallTest
+ @Test
public void testFlags() {
EditorState state = new EditorState();
state.assertEquals("'a' |");
}
- @SmallTest
+ @Test
public void testEmojiModifier() {
EditorState state = new EditorState();
state.assertEquals("|");
}
- @SmallTest
+ @Test
public void testMixedEdgeCases() {
EditorState state = new EditorState();
package android.text.method;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
import android.graphics.Canvas;
import android.graphics.Paint;
import android.text.Editable;
public EditorState() {
}
- /**
- * A mocked {@link android.text.style.ReplacementSpan} for testing purpose.
- */
- private static class MockReplacementSpan extends ReplacementSpan {
- public int getSize(Paint paint, CharSequence text, int start, int end,
- Paint.FontMetricsInt fm) {
- return 0;
- }
- public void draw(Canvas canvas, CharSequence text, int start, int end, float x, int top,
- int y, int bottom, Paint paint) {
- }
- }
-
// Returns true if the code point is ASCII and graph.
private boolean isGraphicAscii(int codePoint) {
return 0x20 < codePoint && codePoint < 0x7F;
throw new IllegalArgumentException(
"ReplacementSpan start position appears after end position.");
}
- spannable.setSpan(new MockReplacementSpan(), replacementSpanStart, replacementSpanEnd,
+
+ ReplacementSpan mockReplacementSpan = mock(ReplacementSpan.class);
+ when(mockReplacementSpan.getSize(any(), any(), any(), any(), any()))
+ .thenReturn(0);
+ doNothing().when(mockReplacementSpan)
+ .draw(any(), any(), any(), any(), any(), any(), any(), any(), any());
+
+ spannable.setSpan(mockReplacementSpan, replacementSpanStart, replacementSpanEnd,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
}
mText = Editable.Factory.getInstance().newEditable(spannable);
package android.text.method;
import android.support.test.filters.SmallTest;
+import android.support.test.runner.AndroidJUnit4;
import android.text.InputType;
import android.view.KeyEvent;
import android.widget.TextView.BufferType;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
/**
* Test forward delete key handling of {@link android.text.method.BaseKeyListener}.
*
* Only contains edge cases. For normal cases, see {@see android.text.method.cts.ForwardDeleteTest}.
* TODO: introduce test cases for surrogate pairs and replacement span.
*/
+@SmallTest
+@RunWith(AndroidJUnit4.class)
public class ForwardDeleteTest extends KeyListenerTestCase {
private static final BaseKeyListener mKeyListener = new BaseKeyListener() {
public int getInputType() {
state.mSelectionEnd = mTextView.getSelectionEnd();
}
- @SmallTest
+ @Test
public void testCombiningEnclosingKeycaps() {
EditorState state = new EditorState();
state.assertEquals("|");
}
- @SmallTest
+ @Test
public void testVariationSelector() {
EditorState state = new EditorState();
state.assertEquals("|");
}
- @SmallTest
+ @Test
public void testEmojiZeroWidthJoinerSequence() {
EditorState state = new EditorState();
state.assertEquals("|");
}
- @SmallTest
+ @Test
public void testFlags() {
EditorState state = new EditorState();
state.assertEquals("| 'b'");
}
- @SmallTest
+ @Test
public void testEmojiModifier() {
EditorState state = new EditorState();
state.assertEquals("|");
}
- @SmallTest
+ @Test
public void testMixedEdgeCases() {
EditorState state = new EditorState();
package android.text.method;
import android.app.Instrumentation;
-import android.test.InstrumentationTestCase;
+import android.support.test.InstrumentationRegistry;
import android.view.KeyEvent;
import android.widget.EditText;
-import com.android.frameworks.coretests.R;
-
-public abstract class KeyListenerTestCase extends InstrumentationTestCase {
-
+public abstract class KeyListenerTestCase {
protected Instrumentation mInstrumentation;
protected EditText mTextView;
public KeyListenerTestCase() {
}
- @Override
- protected void setUp() throws Exception {
- super.setUp();
-
- mInstrumentation = getInstrumentation();
+ protected void setup() {
+ mInstrumentation = InstrumentationRegistry.getInstrumentation();
mTextView = new EditText(mInstrumentation.getContext());
}
package android.text.method;
-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 android.support.test.runner.AndroidJUnit4;
+import android.support.test.filters.SmallTest;
import java.text.BreakIterator;
import java.util.Locale;
+import org.junit.Test;
+import org.junit.runner.RunWith;
// TODO(Bug: 24062099): Add more tests for non-ascii text.
-public class WordIteratorTest extends AndroidTestCase {
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class WordIteratorTest {
- @SmallTest
+ @Test
public void testSetCharSequence() {
final String text = "text";
WordIterator wordIterator = new WordIterator(Locale.ENGLISH);
wordIterator.setCharSequence(text, text.length(), text.length());
}
- @SmallTest
+ @Test
public void testWindowWidth() {
final String text = "aaaa bbbb cccc dddd eeee ffff gggg hhhh iiii jjjj kkkk llll mmmm nnnn";
WordIterator wordIterator = new WordIterator(Locale.ENGLISH);
assertEquals(BreakIterator.DONE, wordIterator.following(expectedWindowEnd));
}
- @SmallTest
+ @Test
public void testPreceding() {
final String text = "abc def-ghi. jkl";
WordIterator wordIterator = new WordIterator(Locale.ENGLISH);
assertEquals(text.indexOf('j'), wordIterator.preceding(text.indexOf('l')));
}
- @SmallTest
+ @Test
public void testFollowing() {
final String text = "abc def-ghi. jkl";
WordIterator wordIterator = new WordIterator(Locale.ENGLISH);
assertEquals(BreakIterator.DONE, wordIterator.following(text.length()));
}
- @SmallTest
+ @Test
public void testIsBoundary() {
final String text = "abc def-ghi. jkl";
WordIterator wordIterator = new WordIterator(Locale.ENGLISH);
assertTrue(wordIterator.isBoundary(text.length()));
}
- @SmallTest
+ @Test
public void testNextBoundary() {
final String text = "abc def-ghi. jkl";
WordIterator wordIterator = new WordIterator(Locale.ENGLISH);
assertEquals(BreakIterator.DONE, currentOffset);
}
- @SmallTest
+ @Test
public void testPrevBoundary() {
final String text = "abc def-ghi. jkl";
WordIterator wordIterator = new WordIterator(Locale.ENGLISH);
assertEquals(BreakIterator.DONE, currentOffset);
}
- @SmallTest
+ @Test
public void testGetBeginning() {
{
final String text = "abc def-ghi. jkl";
}
}
- @SmallTest
+ @Test
public void testGetEnd() {
{
final String text = "abc def-ghi. jkl";
}
}
- @SmallTest
+ @Test
public void testGetPunctuationBeginning() {
final String text = "abc!? (^^;) def";
WordIterator wordIterator = new WordIterator(Locale.ENGLISH);
assertEquals(text.indexOf(';'), wordIterator.getPunctuationBeginning(text.length()));
}
- @SmallTest
+ @Test
public void testGetPunctuationEnd() {
final String text = "abc!? (^^;) def";
WordIterator wordIterator = new WordIterator(Locale.ENGLISH);
assertEquals(BreakIterator.DONE, wordIterator.getPunctuationEnd(text.length()));
}
- @SmallTest
+ @Test
public void testIsAfterPunctuation() {
final String text = "abc!? (^^;) def";
WordIterator wordIterator = new WordIterator(Locale.ENGLISH);
assertFalse(wordIterator.isAfterPunctuation(text.length() + 1));
}
- @SmallTest
+ @Test
public void testIsOnPunctuation() {
final String text = "abc!? (^^;) def";
WordIterator wordIterator = new WordIterator(Locale.ENGLISH);
assertFalse(wordIterator.isOnPunctuation(text.length() + 1));
}
- @SmallTest
+ @Test
public void testApostropheMiddleOfWord() {
// These tests confirm that the word "isn't" is treated like one word.
final String text = "isn't he";
package android.text.util;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
import android.content.Context;
import android.content.res.Configuration;
import android.os.LocaleList;
+import android.support.test.InstrumentationRegistry;
import android.support.test.filters.SmallTest;
-import android.test.AndroidTestCase;
+import android.support.test.runner.AndroidJUnit4;
import android.text.method.LinkMovementMethod;
import android.widget.TextView;
import java.util.Locale;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
/**
* LinkifyTest tests {@link Linkify}.
*/
-public class LinkifyTest extends AndroidTestCase {
+@SmallTest
+@RunWith(AndroidJUnit4.class)
+public class LinkifyTest {
private static final LocaleList LOCALE_LIST_US = new LocaleList(Locale.US);
private LocaleList mOriginalLocales;
+ private Context mContext;
- @Override
- protected void setUp() throws Exception {
- super.setUp();
+ @Before
+ public void setup() {
+ mContext = InstrumentationRegistry.getContext();
mOriginalLocales = LocaleList.getDefault();
LocaleList.setDefault(LOCALE_LIST_US);
}
- @Override
- protected void tearDown() throws Exception {
+ @After
+ public void teardown() {
LocaleList.setDefault(mOriginalLocales);
- super.tearDown();
- }
-
- private Context createUsEnglishContext() {
- final Configuration overrideConfig = new Configuration();
- overrideConfig.setLocales(LOCALE_LIST_US);
- return getContext().createConfigurationContext(overrideConfig);
}
- @SmallTest
- public void testNothing() throws Exception {
+ @Test
+ public void testNothing() {
TextView tv;
tv = new TextView(createUsEnglishContext());
assertTrue(tv.getUrls().length == 0);
}
- @SmallTest
- public void testNormal() throws Exception {
+ @Test
+ public void testNormal() {
TextView tv;
tv = new TextView(createUsEnglishContext());
assertTrue(tv.getUrls().length == 2);
}
- @SmallTest
- public void testUnclickable() throws Exception {
+ @Test
+ public void testUnclickable() {
TextView tv;
tv = new TextView(createUsEnglishContext());
assertFalse(tv.getMovementMethod() instanceof LinkMovementMethod);
assertTrue(tv.getUrls().length == 2);
}
+
+ private Context createUsEnglishContext() {
+ final Configuration overrideConfig = new Configuration();
+ overrideConfig.setLocales(LOCALE_LIST_US);
+ return mContext.createConfigurationContext(overrideConfig);
+ }
}