To inject mock objects into the tested object in a Spring Boot unit test, the _____ annotation is used with Mockito.
- @Autowired
- @InjectMocks
- @MockBean
- @MockitoInject
In Spring Boot unit testing with Mockito, you use the @InjectMocks annotation to inject mock objects into the object being tested. This allows you to control the behavior of dependencies during testing.
Loading...
Related Quiz
- In a Spring Security application, you need to implement a feature where the users' passwords must be rotated every 30 days. How would you approach implementing this feature while maintaining a high level of security?
- Which annotation is primarily used to declare a field to be validated using JSR-303 Bean Validation?
- Which annotation is used to define a bean in the Spring context?
- What is the primary build tool used for Spring Boot projects by default when generating a project using start.spring.io?
- To test interactions with the database in isolation, Spring Boot provides the _____ annotation, which disables full auto-configuration and applies only JPA-related configurations.