Ctrl K
Java · Senior · Theory

How do you build a testing strategy for a Spring Boot service: what do you verify with unit tests using Mockito, what with integration tests, and why?

~4 min by voice

How to approach it

The interviewer wants to see whether you can split tests across levels deliberately: where Mockito gives fast feedback and where you need real infrastructure. They also look at whether you understand the cost of tests (brittleness, CI speed, flakiness) and can back it up with your own team's experience.

Have you seen this question in a real interview?
Answers0
Avg. score—
Strong—
Practiced0
Topics
Similar questionsHow do you write tests with pytest? Tell me about fixtures and how to replace an external dependency in a test. JuniorA Spring Boot service needs to accept report generation tasks, each of which takes several minutes. How would you organize running them inside the Java application? Mid-levelYou have a Spring Boot monolith that a team of thirty people has been developing for five years, and it's started slowing development down. How would you decide whether to split it into services or modularize it internally, and how would you carry out the changes? SeniorHow do you set up testing for a service that works with a database, a message broker and a couple of external APIs? What do you test at which level? SeniorA method is annotated with @Transactional, but when an error occurs the data in the database isn't rolled back. What causes would you check? Mid-level

Answer by voice

The interviewer will ask this question and listen. Think out loud and ask for a hint if you need one. When you're done, pause or tap “That's my answer”. In about a minute, your score and the points you covered show up here.

Sign in to answer

Best with headphones · ~4 min