six2six / fixture-factory

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

Support mock value for fields without setter #12

Closed nykolaslima closed 11 years ago

nykolaslima commented 11 years ago

Example:

public class Account {
private BigDecimal balance;
public BigDecimal getBalance() { return balance; }
// No Setter for balance
}

Fixture-factory should be able to mock "balance" field value. Nowadays this throw an IllegalArgumentException with no such attribute message.

Fixture.of(Account.class).addTemplate("balance", new Rule(){{
add("balance", new BigDecimal("1000");
}});