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

碧玉蓝调:

这是最近开始发生的,但是我不确定是什么原因引起的。

  • 当我从IntelliJ运行所有测试时,一切都很好。gradle构建也很好。
  • 当我运行一个单元测试时,一切都很好。
  • 当我运行单个Web集成测试时,它失败,因为配置类具有所有null属性。

config类看起来像(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跟踪器中记录,并带有待定修复程序。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

在Spring 3中创建单一测试

在IntelliJ Community 2017.1中运行Spring Boot测试时出错

使用RubyMine运行单一测试

Spring Boot 2.1.1 无法在 Intellij 2018.1 中运行

Intellij Spring Boot应用程序无法在Tomcat中运行

无法在Spring Boot中运行任何单元测试

如何使用phpunit运行单一测试方法?

针对Visual Studio中的多种配置运行单一测试

在Spring Boot测试中无法注入@Service

在Spring Boot测试中无法加载ApplicationContext

在Spring Boot测试中无法解析SpringApplicationConfiguration

在IntelliJ中运行Spring Boot导致无法加载'javax.el.ExpressionFactory'

使用Spring Boot运行测试

Spring Boot .JAR无法运行(Maven,Intellij,Hibernate ...)

运行Spring Boot集成测试时无法加载ApplicationContext

Spring Boot单元测试将无法运行。NullInsteadOfMockException

无法使用 Spring Boot 和 Testcontainers 运行 DB 集成测试

Spock测试无法与由start.spring.io创建的新的spring-boot项目一起运行

如何在intellij中运行spring boot应用程序?

如何在Kubernetes中运行Spring Boot集成测试

为什么在Spring Boot测试中未运行@Configuration类?

PyCharm作为类的一部分运行django单一测试

STS / Spring Boot-在IDE中运行Spring Boot项目正在使用测试依赖项

无法在IntelliJ中启动Spring Boot + thymeleaf应用程序

在Spring Boot测试中@Value“无法解析占位符”

Intellij Spring Boot项目运行配置

Spring Boot不运行单元测试

Maven没有运行Spring Boot测试

Spring Boot 单元测试未运行