I have an object which has a public void method on it that just modifies internal state. Part of me feels as though it should have tests as it is a public method but how do you go about testing this? Do you bother or do you rely on the other tests which make use of the fact that the internal state has changed?
To add an example I am implementing a gap buffer which has an insert method on it and a moveCursorForward method which just modifies the internal state.
Thanks,
Aly
I prefer separate tests for such methods. For example, there are two case for “moveCursorForward” method:
1. cursor is already in the end of the buffer
2. cursor is not in the end of the buffer
So it is likely that case 1 will be skipped if you don’t create special test for it.
In other words you can miss some boundary cases.