Which two statements are true regarding Spring and Spring Boot Testing? (Choose two.)
Which two statements are true regarding Spring and Spring Boot Testing? (Choose two.)
Both @SpringBootTest and @SpringJUnitConfig annotations can be used for creating an ApplicationContext in Spring and Spring Boot testing. Additionally, Spring and Spring Boot support both integration testing and slice testing. Integration testing can be done using annotations such as @SpringBootTest, whereas slice testing can be performed using specialized annotations like @WebMvcTest, @DataJpaTest among others, which load only parts of the application context.
D - it is not chosen because @Mock is commonly associated with other mocking frameworks like Mockito.
E is not correct While integration testing and slice testing are both supported in Spring and Spring Boot, they are not both supported by default using a single testing annotation. Integration Testing: Integration testing with Spring is supported using @SpringBootTest or @SpringJUnitConfig. Slice Testing: Slice testing is performed using specialized annotations like @WebMvcTest, @DataJpaTest, etc. These annotations load only a part of the application context to focus
B and D mockito is supported
I have reviewed this question over again and it seems that B and C are the most likely of answers due by process of illumination. A is incorrect for obvious reasons B is correct because @SpringBootTest *OR* @SpringJUnitConfig can be used. I had to wrong in my comment below. That OR makes a big difference. C is correct as Mockito Spy is not supported (only by Spring Framework), but Mockito SpyBean is supported by default. D is incorrect for the same reason as specified in my comment below. E is incorrect for the same reason as specified in my comment below.
BD is most accurate and correct answer. Because of E does not elaborate clearly how slice and integration tests differs in spring and spring boot.
Correct answer is B and E
It seems that C . It is a very tricky question. The Spring AND Spring Boot is where the trick lies. A) INCORRECT: Of course EasyBox is a dependency that is not out of the box. B) INCORRECT: If you consider Spring AND Spring Boot. @SpringBootTest and @SpringJUnitConfig both work in a Spring Boot application, but you cannot use @SpringBootTest in a plain Spring application. C) CORRECT: Mockito spy does come with Spring Boot, but it isn't supported by defualt. D) INCORRECT: spring-boot-starter-test does in fact provide annotations for @Mock and @MockBean, but spring-test by itself doesn't. E) INCORRECT: Only integration testing are supported by both. Slice testing is only a concept in Spring Boot, not in plain Spring.