Ought I to unit test constructors? Say I have a constructor like this:
IMapinfoWrapper wrapper; public SystemInfo(IMapinfoWrapper mapinfoWrapper) { this.wrapper = mapinfoWrapper; }
Do I need to write a unit test for this construtor? I don’t have any getters for the wrapper variable, so I don’t need to test that.
Unit testing is about testing the public states, behaviors, and interactions of your objects.
If you simply set a private field in your constructor, what is there to test?
Don’t bother unit-testing your simple accessors and mutators. That’s just silly, and it doesn’t help anyone.