Flashcards

Quick study sessions to strengthen memory and retain key concepts.

Flashcard Study

Java: Controller Testing

Front

How does Maven's 'clean' phase benefit your build process?

It removes files generated by previous builds. The 'clean' phase in Maven deletes the target directory, ensuring that…

View Card →
Flashcard Study

Java: Controller Testing

Front

Why use @SpringBootTest for integration tests?

It loads the full application context. Frame the concept in practical terms so you can explain it during…

View Card →
Flashcard Study

Java: Controller Testing

Front

What are the design implications of extensive integration testing?

They can lead to tightly coupled code and slower feedback loops. Extensive integration testing can cause developers to…

View Card →
Flashcard Study

Java: Controller Testing

Front

How would you explain a common mistake with MockMvc tests in an interview?

Forgetting to configure the MockMvc object. A common mistake is to forget configuring MockMvc, leading to NullPointerExceptions or…

View Card →
Flashcard Study

Java: Controller Testing

Front

How can you isolate dependencies in controller tests?

Use MockMvc with Mockito to mock dependencies. In controller tests, you can use MockMvc to simulate HTTP requests…

View Card →
Flashcard Study

Java: Controller Testing

Front

Why might integration tests be used sparingly?

They are slower and more complex than unit tests. Integration tests involve multiple components and often require a…

View Card →
Flashcard Study

Java: Controller Testing

Front

Why does @WebMvcTest matter in this design?

It configures a Spring test context for controller testing. @WebMvcTest is used when you want to focus on…

View Card →
Flashcard Study

Java: Controller Testing

Front

How can you validate JSON structures in controller tests?

Use MockMvc to assert JSON response structures. When testing controllers, you often need to verify that the JSON…

View Card →
Flashcard Study

Java: Controller Testing

Front

Why use MockMvc for testing your controllers?

MockMvc allows you to test controllers without starting a server. With MockMvc, you can simulate HTTP requests and…

View Card →
Flashcard Study

Java: Controller Testing

Front

How would you explain a controller test good for in an interview?

Checking routing, validation, status codes, and serialization at the web boundary. Controller tests are narrower than full end-to-end…

View Card →