six2six / fixture-factory

Generator fake objects from a template
Apache License 2.0
445 stars 88 forks source link

#18 Support Set collection with RelationFunction has(n).of #19

Closed nykolaslima closed 11 years ago

nykolaslima commented 11 years ago

@aparra, this PR fixes issue #18 with a cast function. This way it didn't breaks previous code.

Sintax:

Fixture.of(Student.class).addTemplate("valid", new Rule(){{
            add("addresses", set(has(2).of(Address.class, "valid")));
        }});
nykolaslima commented 11 years ago

@aparra @ahirata guys, we will use this sintax to support Set type with "has" function or do you have a better suggestion?

ahirata commented 11 years ago

Hey, I checked the pull request and saw that the implementation uses the collection to build the hashset. We could do that on the ValueProcessor and it would be transparent to the user.

The ValueProcessor is a new class added during the developemnt of the immutable objects feature.

nykolaslima commented 11 years ago

I think it will be better.

I will close this pull request and open a new one with this implementation, this branch is very outdated.