How to mock the EntityManger in springboot mockito integration test
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
classes = [EntityManager::class],
properties = [
"spring.datasource.url=jdbc:mysql://localhost:3306/db"
]
Should i put EntityManager in the classes or i should to mock it differently
I delete the EntityManager from the classes and i forget it from my mocke's class beacause i use JdbcAggregateOperations in the JPA layer.
My new configuration for the integration test is simply like this
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
classes = [],
properties = "spring.datasource.url=jdbc:mysql://localhost:3306/db"])
class DemoApplicationTests(@Autowired val restTemplate: TestRestTemplate,
@Autowired private val repository: UserRepository) {`
thank you