MqReceivertest类无法运行

来源:7-2 RabbitMQ的基本使用(上)

我不想放弃

2020-09-27

https://coding.imooc.com/learn/questiondetail/148098.html
和上面这位同学一样
@Slf4j
@SpringBootTest
@RunWith(SpringRunner.class)
public class MqRecevierTest {

@Autowired
private AmqpTemplate amqpTemplate;

@Test
public void process() {
    amqpTemplate.convertAndSend("myQueue","now",new Date());
}

}

抛错
Internal Error occurred.
org.junit.platform.commons.JUnitException: TestEngine with ID ‘junit-vintage’ failed to discover tests
at org.junit.platform.launcher.core.DefaultLauncher.discoverEngineRoot(DefaultLauncher.java:189)

Caused by: org.junit.platform.commons.JUnitException: MethodSelector [className = ‘com.alfielao.order.message.MqRecevierTest’, methodName = ‘process’, methodParameterTypes = ‘’] resolution failed
at org.junit.platform.launcher.listeners.discovery.AbortOnFailureLauncherDiscoveryListener.selectorProcessed(AbortOnFailureLauncherDiscoveryListener.java:39)

Caused by: org.junit.platform.commons.PreconditionViolationException: Could not load class with name: com.alfielao.order.message.MqRecevierTest

Caused by: java.lang.ClassNotFoundException: com.alfielao.order.message.MqRecevierTest

写回答

1回答

廖师兄

2020-09-30

你用了最新的springBoot版本,pom.xml里有junit-vintage  test,把pom.xml的内容改一下,参考课程源码

0
2
廖师兄
回复
林子懿0509
单测注解加好,@SpringBootTest @RunWith(SpringRunner.class)
2020-10-19
共2条回复

SpringCloud Finchley(M2+RELEASE+SR2)微服务实战

SpringCloud组件实现微服务,【已升级Finchley.Release】

5672 学习 · 2489 问题

查看课程