1 18 19 package org.apache.struts.action; 20 21 import junit.framework.Test; 22 import junit.framework.TestCase; 23 import junit.framework.TestSuite; 24 25 30 public class TestActionMessage extends TestCase { 31 32 protected ActionMessage amWithNoValue = null; 33 34 protected ActionMessage amWithOneValue = null; 35 36 41 public TestActionMessage(String theName) { 42 super(theName); 43 } 44 45 50 public static void main(String [] theArgs) { 51 junit.awtui.TestRunner.main( 52 new String [] { TestActionMessage.class.getName()}); 53 } 54 55 59 public static Test suite() { 60 return new TestSuite(TestActionMessage.class); 62 } 63 64 public void setUp() { 65 amWithNoValue = new ActionMessage("amWithNoValue"); 66 amWithOneValue = 67 new ActionMessage("amWithOneValue", new String ("stringValue")); 68 } 69 70 public void tearDown() { 71 amWithNoValue = null; 72 } 73 74 public void testActionMessageWithNoValue() { 75 assertTrue(amWithNoValue.getValues() == null); 76 assertTrue(amWithNoValue.getKey() == "amWithNoValue"); 77 } 78 79 public void testActionMessageWithAStringValue() { 80 Object [] values = amWithOneValue.getValues(); 81 assertTrue(values != null); 82 assertTrue(values[0].equals("stringValue")); 83 assertTrue(amWithOneValue.getKey() == "amWithOneValue"); 84 } 85 } 86 | Popular Tags |