Testing, Design Patterns and Basic System Design Questions
50 min · Advanced
After the Spring and database questions, a backend round usually moves to three short topics: how you test your code, which design patterns you know, and how your app would handle many more users. Sections 18 (Testing), 19 (Design Patterns) and 21 (System Design) teach them in depth; this lesson keeps only the interview answers.
Topics in this lesson
- Unit vs integration tests; JUnit 5 and Mockito in one minute
- Patterns asked of freshers: Singleton, Factory, Builder, Strategy, Observer
- Patterns inside Spring: proxy, template, singleton beans
- Basic system design answers: load balancing, caching, scaling a database
- Design a URL shortener at fresher level
Interview questions this lesson answers
- What is the difference between a unit test and an integration test?
- What is the test pyramid?
- What annotations do you use most in JUnit 5?
- What is Mockito, and why do you mock?
- What is the difference between
when().thenReturn()andverify()? - What is the difference between a mock, a stub and a fake?
- What is
@MockitoBean? - What do
@WebMvcTest,@DataJpaTestand@SpringBootTestload? - Is 100% code coverage a good goal?
- How do you test a private method?
Sign in free to continue this lesson
Create a free account to read every lesson, practise with the exercises and keep track of your progress.