From 57efd119ae54a9aede3d7014bd066630366dcfd6 Mon Sep 17 00:00:00 2001 From: Johannes Leimer Date: Fri, 15 May 2020 18:39:29 +0200 Subject: [PATCH] #415 adapt test to issue and manually scan for stages @ComponentScan ist not active when using @DataJpaTest. Adding it manually works for now. We should discuss if we want to support that mechanism of Spring Data more deeply. --- .../tngtech/jgiven/example/springboot/JpaTest.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/example-projects/spring-boot/src/test/java/com/tngtech/jgiven/example/springboot/JpaTest.java b/example-projects/spring-boot/src/test/java/com/tngtech/jgiven/example/springboot/JpaTest.java index 72444b8ace..219b2200dd 100644 --- a/example-projects/spring-boot/src/test/java/com/tngtech/jgiven/example/springboot/JpaTest.java +++ b/example-projects/spring-boot/src/test/java/com/tngtech/jgiven/example/springboot/JpaTest.java @@ -1,16 +1,18 @@ package com.tngtech.jgiven.example.springboot; import org.junit.Test; -import org.springframework.boot.test.autoconfigure.orm.jpa.AutoConfigureTestEntityManager; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.mock.web.MockServletContext; +import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; +import org.springframework.context.annotation.ComponentScan; import com.tngtech.jgiven.annotation.JGivenConfiguration; +import com.tngtech.jgiven.integration.spring.EnableJGiven; +import com.tngtech.jgiven.integration.spring.JGivenStage; import com.tngtech.jgiven.integration.spring.SimpleSpringRuleScenarioTest; -@SpringBootTest( classes = { MockServletContext.class, HelloTestContext.class } ) +@DataJpaTest +@ComponentScan(includeFilters = @ComponentScan.Filter(JGivenStage.class)) +@EnableJGiven @JGivenConfiguration( HelloJGivenConfiguration.class ) -@AutoConfigureTestEntityManager public class JpaTest extends SimpleSpringRuleScenarioTest { @Test