Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible with @Nested class test #2692

Closed
violetbeach opened this issue Jun 2, 2023 · 0 comments
Closed

Incompatible with @Nested class test #2692

violetbeach opened this issue Jun 2, 2023 · 0 comments
Milestone

Comments

@violetbeach
Copy link
Contributor

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.

violetbeach added a commit to violetbeach/spring-kafka that referenced this issue Jun 9, 2023
violetbeach added a commit to violetbeach/spring-kafka that referenced this issue Jun 9, 2023
@artembilan artembilan added this to the 3.0.8 milestone Jun 9, 2023
alograg pushed a commit to INTM-Group/spring-kafka that referenced this issue Jun 12, 2023
Fixes spring-projects#2692

When used with `@nested`, Multiple Contexts appear causing test to break.
Contexts caching miss.

* Fix Context Customizer Factory to Work with Nested Test
* Add spring test with nested class
* Fix checkstyle violations
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants