Add tests for public plot method

Also refactored a bit of the unit test code.