/**
* Confirm that the equals method can distinguish all the required fields.
*/
public void testEquals() {
TextFragment tf1 = new TextFragment("Test");
TextFragment tf2 = new TextFragment("Test");
assertTrue(tf1.equals(tf2));
assertTrue(tf2.equals(tf1));
// text
tf1 = new TextFragment("Test 1");
assertFalse(tf1.equals(tf2));
tf2 = new TextFragment("Test 1");
assertTrue(tf1.equals(tf2));
// font
tf1 = new TextFragment("Test 1", new Font("Arial", Font.BOLD, 11));
assertFalse(tf1.equals(tf2));
tf2 = new TextFragment("Test 1", new Font("Arial", Font.BOLD, 11));
assertTrue(tf1.equals(tf2));
// paint
tf1 = new TextFragment("Test 1", new Font("Arial", Font.BOLD, 11), Color.red);
assertFalse(tf1.equals(tf2));
tf2 = new TextFragment("Test 1", new Font("Arial", Font.BOLD, 11), Color.red);
assertTrue(tf1.equals(tf2));
}