Spring Boot无法在IntelliJ中运行单个测试

最近开始发生,但我不确定是什么改变了。

  • 当我从IntelliJ运行所有测试时,一切都很好。 而且gradle build也很好。
  • 当我运行一个unit testing时,一切都很好。
  • 当我运行一个Web集成测试时,它失败,因为一个配置类具有所有的空属性。

配置类看起来像(Kotlin):

@Component @ConfigurationProperties(prefix = "api") public open class ApiConfigImpl : ApiConfig { 

一个测试看起来像:

 @RunWith(SpringJUnit4ClassRunner::class) @ContextConfiguration(classes = arrayOf(ApplicationAssembly::class), loader = SpringApplicationContextLoader::class) @WebIntegrationTest open class CandidateProfileControllerTest { @Inject lateinit var profileRepo: CandidateProfileRepository //etc a few more deps used to setup test data @Test open fun getById() { val greg = CandidateProfile("123", "12312", "Greg", "Jones", dateOfBirth = Date(), gender = Gender.MALE, biography = "ABC", maxMatchableAge = null, maxMatchableDistance = null) profileRepo.save(greg) val auth = given().header("content-type", "application/json") .body(testCredentials) .post("/authorization/social").peek().asString() val accessToken: String = from(auth).get("accessToken") given().header("Access-Token", accessToken). header("API-Key", testAPIKey()). get("/profile/${greg.id}"). peek().then(). body("stageName", notNullValue()) } 

我不知道我可以添加什么信息。 根据所提供的有限信息:

  • 这是一个已知的解决方案已知的问题?

这是一个错误,记录在IntelliJ / Kotlin跟踪器中 ,并有待处理的修复。