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

同一个对象我Mock3次后,最后每个对象的值都变成一样了 #65

Open
adminSxs opened this issue Aug 17, 2021 · 1 comment

Comments

@adminSxs
Copy link

<dependency>
            <groupId>com.github.jsonzou</groupId>
            <artifactId>jmockdata</artifactId>
            <version>4.3.0</version>
            <scope>test</scope>
</dependency>

java代码如下:

        def dto = JMockData.mock(CartDTO, config)
        def itemDto1 = JMockData.mock(CartItemDTO, config);
        itemDto1.setType("VARIANT")
        itemDto1.setQty(10)
        itemDto1.setProductId(1L)
        def itemDto2 = JMockData.mock(CartItemDTO, config);
        itemDto2.setType("STANDARD")
        itemDto2.setQty(10)
        itemDto2.setProductId(2L)
        def itemDto3 = JMockData.mock(CartItemDTO, config);
        itemDto3.setType("NA")
        itemDto3.setQty(10)
        itemDto3.setProductId(3L)

debug 截图
image

@JiaRG
Copy link

JiaRG commented Oct 12, 2021

看情况是 MockConfig#setEnabledCircle(true) 了,配置这个代表启用对象缓存

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants