Repo: https://github.com/nallwhy/spring_boot_rumbl/tree/feature/test_repository
My app has two modules; myapp-domain(business, database, ...), myapp-web(controller, view, ...).
I want to test repositories with @JDBCTest
in domain module, but repository bean is not exist because domain module don't have SpringApplication.
@JdbcTest
@AutoConfigureTestDatabase(replace = AutoConfigureTestDatabase.Replace.NONE)
class UserJDBCDAOTests {
@Autowired
private lateinit var userJDBCDAO: UserJDBCDAO
@Nested
inner class Test_get {
@Test
fun with_exist_user_id() {
val user = userJDBCDAO.create("test@exmaple.com")!!
val get_user = userJDBCDAO.get(user.id)
assertEquals(user, get_user)
}
}
}
How to create repository bean on testing without Spring application?
Aucun commentaire:
Enregistrer un commentaire