JavaThinking.com
Toggle Menu
Home
Online Kotlin Compiler
Tutorials
Spring Boot
Spring Cloud
Spring Data
Spring MVC
Spring Security
Blog
All Posts
Spring Boot Testing
Review your knowledge of unit testing,integration testing,and test slices in Spring Boot.
1. Which annotation is used to mock a Spring bean in Spring Boot tests?
@Mock
@MockBean
@Autowired
@Inject
2. What is the primary purpose of the @WebMvcTest annotation?
Load the entire application context
Test Spring MVC components (controllers)
Test JPA repositories
Test security configurations
3. Which testing framework is the default for unit tests in Spring Boot starter-test?
TestNG
JUnit 5
Spock
Cucumber
4. Which of the following are test slice annotations in Spring Boot?
@WebMvcTest
@DataJpaTest
@SpringBootTest
@RestClientTest
5. Which annotations can disable a test method in JUnit?
@Disabled
@Ignore
@Skip
@Test(enabled = false)
6. @SpringBootTest loads the entire application context for integration testing.
True
False
7. Mockito's @Mock annotation alone can replace a Spring-managed bean in @SpringBootTest.
True
False
8. What does JUnit stand for? (full form)
9. Name the annotation used to mark a test method in JUnit 5.
10. What is the most common mocking framework used in Spring Boot tests?
Reset
Answered 0 of 0 — 0 correct