use of java.text.BreakIterator in project j2objc by google.
the class BreakIteratorTest method testCache.
public void testCache() {
BreakIterator newOne = BreakIterator.getCharacterInstance(Locale.US);
assertNotSame(newOne, iterator);
assertEquals(newOne, iterator);
newOne = BreakIterator.getCharacterInstance();
assertEquals(newOne, iterator);
newOne = BreakIterator.getCharacterInstance(Locale.CHINA);
assertEquals(newOne, iterator);
BreakIterator wordIterator = BreakIterator.getWordInstance();
assertFalse(wordIterator.equals(iterator));
BreakIterator lineIterator = BreakIterator.getLineInstance();
assertFalse(lineIterator.equals(iterator));
BreakIterator senteIterator = BreakIterator.getSentenceInstance();
assertFalse(senteIterator.equals(iterator));
}
use of java.text.BreakIterator in project j2objc by google.
the class BreakIteratorTest method testGetWordInstanceLocale.
/*
* Class under test for BreakIterator getWordInstance(Locale)
*/
public void testGetWordInstanceLocale() {
BreakIterator it = BreakIterator.getWordInstance(Locale.US);
assertNotNull(it);
}
use of java.text.BreakIterator in project j2objc by google.
the class BreakIteratorTest method testClone.
public void testClone() {
BreakIterator cloned = (BreakIterator) iterator.clone();
assertNotSame(cloned, iterator);
assertEquals(cloned, iterator);
}
use of java.text.BreakIterator in project j2objc by google.
the class BreakIteratorTest method testFollowing.
public void testFollowing() {
BreakIterator it = BreakIterator.getCharacterInstance(Locale.US);
it.setText("hello");
try {
it.following(-1);
fail();
} catch (IllegalArgumentException expected) {
// Expected exception
}
assertEquals(1, it.following(0));
assertEquals(2, it.following(1));
assertEquals(5, it.following(4));
assertEquals(BreakIterator.DONE, it.following(5));
try {
it.following(6);
fail();
} catch (IllegalArgumentException expected) {
// Expected exception
}
}
use of java.text.BreakIterator in project j2objc by google.
the class BreakIteratorTest method testPreceding.
public void testPreceding() {
BreakIterator it = BreakIterator.getCharacterInstance(Locale.US);
it.setText("hello");
try {
it.preceding(-1);
fail();
} catch (IllegalArgumentException expected) {
// Expected exception
}
assertEquals(BreakIterator.DONE, it.preceding(0));
assertEquals(0, it.preceding(1));
assertEquals(4, it.preceding(5));
try {
it.preceding(6);
fail();
} catch (IllegalArgumentException expected) {
// Expected exception
}
}
Aggregations