mercredi 19 août 2020

How can i Test Spring JPA queries to Memory Database using Mockito?

I am using Mockito to make Unit Test. However, I need to test if the queries I am creating with Spring Data all of them are correct, so I don't want to mock that particular class, I just want to use a memory database to see how the real queries work.

  1. Does my only option it s to use @Runwith(SpringRunner.class) in the test and to have access to the Spring context so I can do that? Or if I continue with @RunWith(MockitoJUnitRunner.class) I have some way to achieve that?

  2. Is ok to have in the application a couple of test With SpringRunner and others with MockitoRunner(Faster tests)?

  3. What I want to do is consider an Integration Test or it s a Unit Test?

Aucun commentaire:

Enregistrer un commentaire