/**
* Tests clone() and equals() methods of RuleBasedBreakIterator
**/
public void TestCloneEquals() {
RuleBasedBreakIterator bi1 = (RuleBasedBreakIterator) BreakIterator.getCharacterInstance(Locale.getDefault());
RuleBasedBreakIterator biequal = (RuleBasedBreakIterator) BreakIterator.getCharacterInstance(Locale.getDefault());
RuleBasedBreakIterator bi3 = (RuleBasedBreakIterator) BreakIterator.getCharacterInstance(Locale.getDefault());
RuleBasedBreakIterator bi2 = (RuleBasedBreakIterator) BreakIterator.getWordInstance(Locale.getDefault());
String testString = "Testing word break iterators's clone() and equals()";
bi1.setText(testString);
bi2.setText(testString);
biequal.setText(testString);
bi3.setText("hello");
logln("Testing equals()");
logln("Testing == and !=");
if (!bi1.equals(biequal) || bi1.equals(bi2) || bi1.equals(bi3))
errln("ERROR:1 RBBI's == and !- operator failed.");
if (bi2.equals(biequal) || bi2.equals(bi1) || biequal.equals(bi3))
errln("ERROR:2 RBBI's == and != operator failed.");
logln("Testing clone()");
RuleBasedBreakIterator bi1clone = (RuleBasedBreakIterator) bi1.clone();
RuleBasedBreakIterator bi2clone = (RuleBasedBreakIterator) bi2.clone();
if (!bi1clone.equals(bi1)
|| !bi1clone.equals(biequal)
|| bi1clone.equals(bi3)
|| bi1clone.equals(bi2))
errln("ERROR:1 RBBI's clone() method failed");
if (bi2clone.equals(bi1)
|| bi2clone.equals(biequal)
|| bi2clone.equals(bi3)
|| !bi2clone.equals(bi2))
errln("ERROR:2 RBBI's clone() method failed");
if (!bi1.getText().equals(bi1clone.getText())
|| !bi2clone.getText().equals(bi2.getText())
|| bi2clone.equals(bi1clone))
errln("ERROR: RBBI's clone() method failed");
}