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
paint method.)
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?
Thanks,
The Sunburned Surveyor
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Jump-pilot-devel mailing list
Jump-pilot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jump-pilot-devel