1 Star 0 Fork 0

greitzmann/SpringBoot-RabbitMQ

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
ApplicationTest.java 853 Bytes
一键复制 编辑 原始数据 按行查看 历史
第七座城市 提交于 2016-12-25 11:44 +08:00 . spring boot rabbit test
package hello;
import java.util.concurrent.TimeUnit;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class ApplicationTest {
@MockBean
private Runner runner;
@Autowired
private RabbitTemplate rabbitTemplate;
@Autowired
private Receiver receiver;
@Test
public void test() throws Exception {
rabbitTemplate.convertAndSend(Application.queueName, "Hello from RabbitMQ!");
receiver.getLatch().await(10000, TimeUnit.MILLISECONDS);
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/greitzmann/SpringBoot-RabbitMQ.git
git@gitee.com:greitzmann/SpringBoot-RabbitMQ.git
greitzmann
SpringBoot-RabbitMQ
SpringBoot-RabbitMQ
master

搜索帮助