Skip to content

Incompatible with @Nested class test #2692

@violetbeach

Description

@violetbeach

In what version(s) of Spring for Apache Kafka are you seeing this issue?
2.7.2 (maybe All)

Describe the bug

when used with @nested, Multiple Contexts appear causing test to break.

Contexts caching miss.

To Reproduce

�this following situations are likely to cause problems.

@EmbeddedKafka
@SpringBootTest
class BeanTwiceTest {

    @Nested
    class NestedClass {
        
        @Test
        void test() {
        }
        
    }
    
}

As a result, errors may occur when using libraries such as WireMock, Restdocs, and contexts may not be reused as intended. (Mockito.verify(instance, times()) fails, etc.)

Expected behavior

Context should appear only once. (Caching must be successful.)

Sample

below is an example of only the test in the Nested Class being broken. (but. After modified)

The contents are summarized below.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions