Skip to content

Spring TestExecutionListener doesn't work with nested classes #1979

@nickcaballero

Description

@nickcaballero

Describe the issue

When using nested JUnit5 classes, the Spring TestExecutionListener is not working properly:

  • Does not detect the annotation on the parent class
  • Does not inject field in parent class when annotation is present on nested class

What you are trying to do

Use the Spring TestExecutionListener with nested classes.

MockServer version

5.14.0

To Reproduce

  • Create a test class annotated with @MockServerTest and @SpringBootTest
  • Add a nested class annotated with @Nested with a single test
  • Add a field to the parent class to receive the ClientAndServer
  • Run the test

Expected behaviour

  • The @MockServerTest is detected
  • The ClientAndServer field in the parent class is initialized

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions