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.)
A . EasyMock is supported out of the box.
B . @SpringBootTest or @SpringJUnitConfig can be used for creating an ApplicationContext.
C . Mockito spy is not supported in Spring Boot testing by default.
D . The spring-test dependency provides annotations such as @Mock and @MockBean.
E . Integration and slice testing are both supported.

Answer: BE

Explanation:

Spring and Spring Boot provide various annotations and utilities to support testing of different layers of the application. To create an ApplicationContext for integration tests, we can use either @SpringBootTest or @SpringJUnitConfig annotations. The former is a specialized annotation that also provides additional features such as auto-configuration, web environment emulation, and test properties management. The latter is a general-purpose annotation that combines @ContextConfiguration and @ExtendWith(SpringExtension.class) annotations.

To perform slice testing, which focuses on testing a specific layer or feature of the application in isolation, we can use annotations such as @WebMvcTest, @DataJpaTest, @RestClientTest, etc. These annotations will only load the relevant beans for the tested slice and mock or stub the other dependencies.

Reference: https://docs.spring.io/spring-boot/docs/2.1.5.RELEASE/reference/html/boot-features-testing.html

Latest 2V0-72.22 Dumps Valid Version with 60 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments