01: package org.mockejb.jms.test;
02:
03: import javax.jms.*;
04:
05: import org.mockejb.jms.TextMessageImpl;
06:
07: /**
08: * Tests <code>TextMessageImpl</code>.
09: *
10: * @author Dimitar Gospodinov
11: */
12: public class TextMessageImplTest extends MessageTester {
13:
14: private TextMessage msg;
15:
16: public TextMessageImplTest(String name) {
17: super (name);
18: }
19:
20: protected void setUp() throws Exception {
21: msg = new TextMessageImpl();
22: message = msg;
23: super .setUp();
24: }
25:
26: protected void tearDown() throws Exception {
27: msg = null;
28: }
29:
30: public void testTextMessage() throws JMSException {
31:
32: assertNull(msg.getText());
33: msg.setText("Text");
34: assertEquals(msg.getText(), "Text");
35: msg.setText("Text1");
36: assertEquals(msg.getText(), "Text1");
37: msg.clearBody();
38: assertNull(msg.getText());
39: msg.setText("Text2");
40:
41: TextMessage msg1 = new TextMessageImpl(msg);
42: assertEquals(msg1.getText(), "Text2");
43:
44: checkMessageAttributes(msg1);
45: checkMessageAttributes();
46:
47: msg = new TextMessageImpl("Text3");
48: assertEquals(msg.getText(), "Text3");
49: }
50: }
|