1 42 43 package org.jfree.util.junit; 44 45 import java.awt.Color ; 46 import java.awt.font.TextAttribute ; 47 import java.text.AttributedString ; 48 49 import junit.framework.Test; 50 import junit.framework.TestCase; 51 import junit.framework.TestSuite; 52 53 import org.jfree.util.AttributedStringUtilities; 54 55 58 public class AttributedStringUtilitiesTests extends TestCase { 59 60 65 public static Test suite() { 66 return new TestSuite(AttributedStringUtilitiesTests.class); 67 } 68 69 74 public AttributedStringUtilitiesTests(String name) { 75 super(name); 76 } 77 78 81 public void testEqual() { 82 assertTrue(AttributedStringUtilities.equal(null, null)); 83 84 AttributedString s1 = new AttributedString ("ABC"); 85 assertFalse(AttributedStringUtilities.equal(s1, null)); 86 assertFalse(AttributedStringUtilities.equal(null, s1)); 87 88 AttributedString s2 = new AttributedString ("ABC"); 89 assertTrue(AttributedStringUtilities.equal(s1, s2)); 90 91 s1.addAttribute(TextAttribute.BACKGROUND, Color.blue, 1, 2); 92 assertFalse(AttributedStringUtilities.equal(s1, s2)); 93 s2.addAttribute(TextAttribute.BACKGROUND, Color.blue, 1, 2); 94 assertTrue(AttributedStringUtilities.equal(s1, s2)); 95 } 96 97 } 98 | Popular Tags |