spring-projects / spring-projects/spring-modulith
[UnitTest] Check for specific amount of events to arrive
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 222
- PR merge metrics
- No merged PRs in 30d
Description
This issue is based on this discussion.
I want to create a test that checks for a specific number of events being published. The usecase here is that it should only publish events until a given limit of currently executing jobs is reached. This limit is used to prevent one instance of the service to block all jobs while another instance is idle.
scenario.stimulate(() -> collector.poll())
.andWaitAtMost(Duration.ofSeconds(5))
.andWaitForEventOfType(NewJobEvent.class)
.count(3)
.toArrive();
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the scenario.stimulate(...).andWaitForEventOfType(...).count(3).toArrive() API shown in the issue and review discussion 589 for the intended behavior. Done when a test can assert that exactly three NewJobEvent events arrive within the existing wait flow.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100