
unit-test-application-events
Provides patterns for unit testing Spring application events
by giuseppe-trisciuoglioFree
Description
This agent skill gives patterns for writing unit tests for Spring application events, using JUnit 5 and Mockito. It targets two sides of the event flow. On the publisher side, it checks that a service publishes an ApplicationEvent through ApplicationEventPublisher and that the event carries the right payload. On the listener side, it checks that an @EventListener method runs and produces the expected side effects, and that an event travels correctly through more than one listener. It also covers asynchronous handling, where @Async is combined with @EventListener. The main point of the skill is that the tests run without booting the full Spring context, which keeps them fast. The skill lists when to use it: writing tests for an event publisher or listener, checking an event's payload, testing listener side effects, and mocking ApplicationEventPublisher inside service tests. It is an instruction set for an AI coding agent working on a Java codebase, and it sits in the developer-kit repository by giuseppe-trisciuoglio, which has about 371 stars on GitHub.…
Highlights
- Verify that events are published with the right payload
- Test @EventListener methods and their side effects
- Check event propagation through several listeners
- Test async listeners that use @Async
- Mock ApplicationEventPublisher in service tests
Ratings & Reviews
No ratings yet
Be the first to rate unit-test-application-events.
People also visit

unit-test-config-properties
Provides patterns for unit testing `@ConfigurationProperties` classes
unit-test-application-events FAQ
Does it need a running Spring context?
No. The skill is built around unit tests that run without booting the full Spring context.
Which test tools does it use?
It uses JUnit 5 and Mockito.
Does it cover async listeners?
Yes. It covers validating async event handling with @Async and @EventListener.
How do I install it?
Run npx skills add https://github.com/giuseppe-trisciuoglio/developer-kit --skill unit-test-application-events.
What security audits has it passed?
Gen Agent Trust Hub: Pass. Socket: Pass. Snyk: Pass.
What are the best unit-test-application-events alternatives?
Popular alternatives to unit-test-application-events include unit-test-exception-handler, unit-test-scheduled-async and unit-test-caching. See all unit-test-application-events alternatives












