在 Intellij 中为这个特定项目设置 JUnit

问题描述

我正在尝试为这个项目设置 JUnit4,并且已经提供了测试。 但是java文件看起来很奇怪,它不允许我将JUnit添加到类路径中。

enter image description here

这里是初学者,完全不知道发生了什么:(

解决方法

您没有将 tests 目录设置为 Test Source Root 目录 YouTube Issue forum.。您可以在项目工具窗口中的目录上下文菜单中标记它: category

有关步骤,另请参阅 enter image description here 官方文档。