1 25 29 package org.jresearch.gossip.util.test; 30 31 import java.util.ResourceBundle ; 32 33 import junit.framework.TestCase; 34 35 import org.apache.struts.util.MessageResources; 36 import org.jresearch.gossip.exception.ConfiguratorException; 37 import org.jresearch.gossip.util.MessageProcessor; 38 39 43 public class MessageProcessorTest extends TestCase { 44 45 MessageResources messages; 46 47 MessageProcessor mp; 48 49 52 protected void setUp() throws Exception { 53 super.setUp(); 54 MessageProcessor.setEmoticonsMap(ResourceBundle 55 .getBundle("org/jresearch/gossip/resources/emoticon")); 56 mp = MessageProcessor.getInstance(); 57 messages = MessageResources 58 .getMessageResources("org.jresearch.gossip.resources.lang.lang"); 59 } 60 61 64 protected void tearDown() throws Exception { 65 super.tearDown(); 66 } 67 68 73 public MessageProcessorTest(String name) { 74 super(name); 75 } 76 77 public void testPrepareMessage() { 78 79 System.out 80 .println(mp 81 .prepareMessage( 82 "[b]line1[/b] ;) line2 [NOSMILE];)[/NOSMILE];)[NOSMILE];)[/NOSMILE];)", 83 0, messages)); 84 System.out 85 .println(mp 86 .prepareMessage( 87 "[b]line1[/b] ;) line2 [NOSMILE];)[/NOSMILE];)[NOSMILE];)[/NOSMILE];)", 88 12, messages)); 89 } 90 91 public void testCleanup() { 92 System.out 93 .println(mp 94 .cleanup("line1 ;) line2 [NOSMILE];)[/NOSMILE];)[NOSMILE];)[/NOSMILE];)")); 95 } 96 97 public void testNl2br() { 98 System.out.println(mp.nl2br("\nline1 \n line2\n")); 99 } 100 101 public void testProcessEmoticons() throws ConfiguratorException { 102 System.out 103 .println(mp 104 .processEmoticons( 105 "line1 ;) line2 [NOSMILE];)[/nOsMiLe];)[NOSMILE];)[/NOSMILE];)", 106 messages)); 107 } 108 109 } | Popular Tags |