six2six / fixture-factory

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

Adding element to a property List without setter #120

Open vinigarcia87 opened 1 year ago

vinigarcia87 commented 1 year ago

He guys, trying to create a fixture like this one:

Fixture.of(ArrayOfResultBranchListDTO.class).addTemplate(BRANCH, new Rule() {{
    add("resultBranchListDTO", one(ResultBranchListDTO.class, ResultBranchListDTOTemplate.BRANCH));
}});

The class ArrayOfResultBranchListDTO is defined like this:

public class ArrayOfResultBranchListDTO {

    protected List<ResultBranchListDTO> resultBranchListDTO;

    public ArrayOfResultBranchListDTO() {
    }

    public List<ResultBranchListDTO> getResultBranchListDTO() {
        if (this.resultBranchListDTO == null) {
            this.resultBranchListDTO = new ArrayList();
        }

        return this.resultBranchListDTO;
    }
}

The code can't find the attribute resultBranchListDTO, I get the following error:

ArrayOfResultBranchListDTO-> No such attribute: resultBranchListDTO

I'm using version 3.1.0.

Can someone help me with this? Thanks!