Skip to content

Commit

Permalink
#415 adapt test to issue and manually scan for stages
Browse files Browse the repository at this point in the history
@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.
  • Loading branch information
leimer authored and janschaefer committed May 16, 2020
1 parent 40430a2 commit 57efd11
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -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<JpaStage> {

@Test
Expand Down

0 comments on commit 57efd11

Please sign in to comment.