Loading skill
Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Provides JUnit 5 and Mockito patterns for unit testing Spring application event publishers, @EventListener consumers, and async handlers.
95% 100%+5 ptsof test cases passed
Passed 22 of 22 test cases with the skill, and 21 of 22 without it.
3 of 3 safety checks passed
Not used yet
Provides actionable patterns for testing Spring ApplicationEvent publishers and @EventListener consumers using JUnit 5 and Mockito — without booting the full Spring context.
@EventListener method invocation and side effects@Async + @EventListener)ApplicationEventPublisher in service testsspring-boot-starter, JUnit 5, Mockito, AssertJ@Mock on the publisher field in the service under testArgumentCaptor.forClass(EventType.class) to inspect published payloadThread.sleep() or Awaitility — then assert the async operation was calledeventCaptor.getValue() is not null before asserting fieldspublishEvent() was called with the correct event type<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
Next to this one in the catalogue, plus more from the same author.