I've been unable to locate the null pointer bug in my pluggable renderer
code. I'm going back to write JUnit tests for my classes in
an effort to catch the error, which I should've done in the first place.
However, this is a little easier said than done. One of the
classes I need to test calls the constructor of the LayerRenderer class.
This constructor requires two arguments. One of these arguments is
the LayerViewPanel upon which the Layer will be painted. (Obviously the
LayerRenderer needs this reference because it needs to call the components
Creating a LayerViewPanel within a JUnit test seems like a little overkill.
I don't want to actually test the rendering behavior of the renderer
that is returned by the constructor, I just want to make sure when I call
the constructor inderectly through the method under test that I am passed
a valid LayerRenderer object and not a null object. To create a
LayerViewPanel I would need to create a bunch of other classes. Is there a
way to pass
a dummy reference or null reference to a LayerRenderer into the constructor?
Is this what they mean when they talk about testing with mock objects or
stubs? Any suggestions on where I can read more about this?
The Sunburned Surveyor
Get latest updates about Open Source Projects, Conferences and News.