【发布时间】:2020-01-31 08:49:00
【问题描述】:
我目前正在使用带有 AssertJ 的 JUnit 4.x。我想确保没有使用 Hamcrest 偷偷摸摸。但是,Hamcrest Core 是 JUnit 在运行时必需的依赖项,请参阅 Junit issue #1429: A Exception for junit4.12 about org/hamcrest/SelfDescribing #1429 ,因此直接从 pom.xml 中排除依赖项或调整 maven-surefire-plugin 类路径将不起作用。
我正在寻找的是一种调整测试编译器类路径的方法,但是我在maven-compiler-plugin中没有找到这样的选项。
如何确保我的测试不使用 Hamcrest 断言?我想在构建时使用 Maven 强制执行此操作。
【问题讨论】:
标签: java maven junit hamcrest assertj