I am trying to test a JAX-RS application but I'd rather not mock the data especially since there's a buildData
method for an existing @DataJpaTest
Here's what I am trying so far:
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(
webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
classes = MyApp.class
)
@DirtiesContext
@DataJpaTest
public class MyResourceTest {
I get the following error
java.lang.IllegalStateException: Configuration error: found multiple declarations of @BootstrapWith for test class [app.MyResourceTest]: [@org.springframework.test.context.BootstrapWith(value=class org.springframework.boot.test.context.SpringBootTestContextBootstrapper), @org.springframework.test.context.BootstrapWith(value=class org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTestContextBootstrapper)]
The other ones I saw that are similar do not talk about the webEnvironment
setting:
- How do I import configuration classes in a @DataJpaTest in a SpringBootTest?
- Recommended way to remove @DataJpaTest when used along with @SpringBootTest
Aucun commentaire:
Enregistrer un commentaire