mockneat icon indicating copy to clipboard operation
mockneat copied to clipboard

question: How to add unique objects to a list

Open DNWEIJ opened this issue 3 years ago • 3 comments

given the example:

final private MockUnit<Child> childGenerator =
        reflect(Child.class)
                .field("id", UUID.fromString(uuids().get()))
                .useDefaults(true);

final private MockUnit<Parent> parentGenerator =
        reflect(Parent.class)
                .field("id", UUID.fromString(uuids().get()))
                .field("child", childGenerator.list(2))
                .useDefaults(true);

This will result in a list of children having the same id (parent.child(0).id = parent.child(1).id) . I have been trying to resolve it to use the supplier but cannot get it to work.

In general, the question would be: How to get a list of unique objects using diffenre object generators; Meaning the value within the objects are not the same in the list of objects.

DNWEIJ avatar Jul 04 '22 10:07 DNWEIJ

any one?

DNWEIJ avatar Aug 18 '22 07:08 DNWEIJ

project seems dead.....

DNWEIJ avatar Aug 30 '22 06:08 DNWEIJ

@DNWEIJ project is not dead. Sorry, I had the notifications turned off for the MockNeat issues. Is this still a problem for you ?

nomemory avatar Sep 19 '22 11:09 nomemory