In Spring Boot, how do you customize the behavior of a mocked object for specific arguments using Mockito?

  • By using the @InjectMocks annotation
  • By using the @Mockito annotation
  • By using the @Spy annotation
  • By using the when(...).thenReturn(...) syntax
To customize the behavior of a mocked object for specific arguments using Mockito in Spring Boot, you can use the when(...).thenReturn(...) syntax. This allows you to specify the return value of a method call based on the input arguments. The other annotations mentioned are used for different purposes in Mockito.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *