Which two statements are true regarding @DataJpaTest? (Choose two.)
Which two statements are true regarding @DataJpaTest? (Choose two.)
TestEntityManager provides a subset of functionality focused on testing, not all methods of EntityManager, so A is incorrect. @DataJpaTest is specifically designed for JPA components and not NoSQL, making C incorrect. It also cannot be used for JdbcTemplate testing, making E incorrect. If an embedded database is on the classpath, it is used to configure a DataSource by default, and @DataJpaTest auto-configures a TestEntityManager bean, making B and D the correct choices.
A is incorrect because TestEntityManager does not provide all methods that are provided by EntityManager. It only provides a subset of the methods that are relevant for testing. C is incorrect because @DataJpaTest is specifically designed for testing JPA components. It cannot be used for testing NoSQL components. E is incorrect because @DataJpaTest cannot be used for testing JdbcTemplate. JdbcTemplate is a different type of data access abstraction that is not related to JPA.
why not A instead of B , because @DataJpaTest does not configure any DataSource by default. A and D
A is correct as well as D, why A? here is the reason, TestEntityManager extends EntityManager which means it inherits all methods of EntityManager and adds more specialized methods specifically for testing purposes.