EasyMock Tutorial: Mocking with EasyMock 5 and JUnit 5
EasyMock tutorial with JUnit 5. Create mocks, record expectations, replay and verify, mock void methods, use matchers, captures and nice or strict mocks.
EasyMock tutorial with JUnit 5. Create mocks, record expectations, replay and verify, mock void methods, use matchers, captures and nice or strict mocks.
Learn some popular and the most used Java unit testing frameworks used for mocking the test dependencies and verifying the test results.
Spring boot @MockBean annotation used to add mocks to a Spring ApplicationContext. In this tutorial, we will learn the different ways to use this annotation.
Learn to unit test given Spring rest controller APIs using Junit 5 and mockito. This technique can be applied to spring boot as well as spring MVC applications, both.
Learn to test spring boot async rest controller using MockMVC and @WebMvcTest which support async requests and return CompletableFuture as response type.
In this mockito tutorial, learn the fundamentals of the mockito framework, and how to write JUnit tests along with mockito with an example.
Unit test a Spring Boot service with JUnit and Mockito. Mock the repository with @Mock, build the service with @InjectMocks, stub with when().thenReturn() and check calls with verify(). Also covers @MockitoBean in @SpringBootTest, thenThrow, ArgumentCaptor, BDDMockito, strict stubs and the Mockito Java agent on Java 21+.
Learn PowerMock with JUnit 4 and Mockito for static, final, private and constructor mocks, why it fails on Java 17+, and how Mockito 5 replaces it.
HowToDoInJava provides tutorials and how-to guides on Java and related technologies.
It also shares the best practices, algorithms & solutions and frequently asked interview questions.