【发布时间】:2020-04-16 15:51:06
【问题描述】:
我使用 JUnit 5.4、Java 8、Gradle 6.3 和 Intellij Idea Community 2020.1 编写了一些单元测试。
我尝试使用 @DisplayName 注释,当我在 Intellij 中运行测试时,注释值不会显示在运行测试结果中,但是当我使用 Gradle 运行测试时,注释工作正常。
这是我的代码:
@DisplayName("A bookshelf")
class BookShelfTests {
private BookShelf shelf;
@BeforeEach
void init() throws Exception {
shelf = new BookShelf();
}
@Test
@DisplayName("is empty when no book is added to it")
void shelfEmptyWhenNoBookAdded() throws Exception {
List<Book> books = shelf.books();
assertTrue(books.isEmpty(), "BookShel should be empty");
}
}
请帮助我了解配置 Intellij 以显示 JUnit @Display 值需要做什么?
谢谢!!
【问题讨论】:
标签: java gradle intellij-idea junit junit5