Skip to content

Access recorded ApplicationEvents across all threads in the TestContext framework #28919

@jhyot

Description

@jhyot

Affects: 5.3.22


Feature Request:

When using @RecordApplicationEvents, currently the ApplicationEventsHolder uses a ThreadLocal to save published events. Can this be extended to also retrieve events across all threads?

Use cases:

  • Assert on async events
  • Whether or not the event itself was async, when using an async test library like Awaitility in this way:
    await().untilAsserted(() -> assertThat(applicationEvents.stream())..... );
    The assertion runs in a different thread (so that Awaitility can time and interrupt if necessary), so no events are found whatsoever.

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: testIssues in the test modulestatus: supersededAn issue that has been superseded by anothertype: enhancementA general enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions