1 package test.message; 2 3 import junit.framework.TestCase; 4 5 import org.apache.axis.message.Text; 6 7 12 public class TestText extends TestCase 13 { 14 15 private static final String VANILLA = "vanilla"; 16 private static final String CHOCOLATE = "chocolate"; 17 private static final String NULL = null; 18 19 private Text vanillaText; 20 private Text chocolateText; 21 private Text nullText; 22 private Text vanillaText2; 23 24 protected void setUp() throws Exception 25 { 26 vanillaText = new org.apache.axis.message.Text( VANILLA ); 27 vanillaText2 = new org.apache.axis.message.Text( VANILLA ); 28 chocolateText = new org.apache.axis.message.Text( CHOCOLATE ); 29 nullText = new org.apache.axis.message.Text( NULL ); 30 } 31 32 37 public void testToString() throws Exception 38 { 39 assertEquals( VANILLA, vanillaText.toString() ); 40 assertEquals( NULL, nullText.toString() ); 41 } 42 43 48 public void testHashCode() throws Exception 49 { 50 assertEquals( VANILLA.hashCode(), vanillaText.hashCode() ); 51 assertEquals( 0, nullText.hashCode() ); 52 } 53 54 59 public void testEquals() throws Exception 60 { 61 assertEquals( vanillaText, vanillaText2 ); 62 assertEquals( vanillaText2, vanillaText ); 63 assertTrue( !vanillaText.equals( chocolateText ) ); 64 assertTrue( !chocolateText.equals( vanillaText ) ); 65 assertTrue( !vanillaText.equals( null ) ); 66 assertTrue( !vanillaText.equals( VANILLA ) ); 67 } 68 69 } 70 | Popular Tags |