codereligion / beast

Provides utilities for testing Java beans.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

add support for direct property mutation

SierraGolf opened this issue · comments

background
currently the properties of the class under test are only mutated through their public setters. if there is none, no mutation is possible for these properties. the reason for choosing this strategy was that this is the best way to be able to mutate inherited properties which might be private to the super class, but have public setter which the class under test has inherited.

why do we need direct property mutation then?
sometimes a class can be mutated from outside without having a specific setter. this can be through a side-effect of another setter or another method.

implementation notes
the public setter strategy should be the default setting and the documentation should state that the user should only use the direct property mutation strategy if he does not care about inherited properties and wants to test explicitly that a property is contained or not contained in the implementations of equals, hashCode or toString which can not be directly mutated through a public setter.