Junit tests
JUnit Tests for default text messages and custom converted messages
This commit is contained in:
parent
d640b9818d
commit
b253563e67
|
@ -0,0 +1,26 @@
|
|||
package com.baeldung.spring.jms;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import com.baeldung.spring.jms.SampleJmsMessageSender;
|
||||
|
||||
public class DefaultTextMessageSenderTest {
|
||||
|
||||
private SampleJmsMessageSender messageProducer;
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
@Before
|
||||
public void setUp() {
|
||||
ApplicationContext applicationContext = new ClassPathXmlApplicationContext(new String[] { "classpath:EmbeddedActiveMQ.xml", "classpath:applicationContext.xml" });
|
||||
messageProducer = (SampleJmsMessageSender) applicationContext.getBean("SampleJmsMessageSender");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleSend() {
|
||||
messageProducer.simpleSend();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package com.baeldung.spring.jms;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
|
||||
import com.baeldung.spring.jms.Employee;
|
||||
import com.baeldung.spring.jms.SampleJmsMessageSender;
|
||||
|
||||
public class MapMessageConvertAndSendTest {
|
||||
|
||||
private SampleJmsMessageSender messageProducer;
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
@Before
|
||||
public void setUp() {
|
||||
ApplicationContext applicationContext = new ClassPathXmlApplicationContext(new String[] { "classpath:EmbeddedActiveMQ.xml", "classpath:applicationContext.xml" });
|
||||
messageProducer = (SampleJmsMessageSender) applicationContext.getBean("SampleJmsMessageSender");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSendMessage() {
|
||||
messageProducer.sendMessage(new Employee("JavaDeveloper2", 22));
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue