If the method is void , it clearly has some side effects. Otherwise, it would be non-op. Thus, you have no choice and need to check for these side effects.
How to check for these side effects depends on the technology used and the testing approach:
if the method calls some other collaborators / objects, mock and then checks mocks
if it changes the state of some other components (adding elements to the collection, changing the field) and approves them
if it stores something on disk / database, request them also
if it displays some window in Swing, you need to use Swing testing framework like Window Licker
if ... could you provide some technical details ?
BTW A typesetter who runs some additional unrelated logic is code smell. It will be very difficult for people who support such code to understand that this innocent setPersonObj() doing something other than ... customization.
Also, all of these names: Person , PersonObj and typeObj must be the same for consistency and compatibility with the JavaBean specification.
Tomasz Nurkiewicz
source share