On Jun 29, 2009, at 12:05 PM, Asiri Rathnayake wrote:

> Hi,
>
>> May be override the tearDown() method and cleanup the file? But I'm
>>> not sure
>>> if this is possible with the way rendering tests are done.
>>
>> No, no.
>>
>> There are 2 options:
>> - Best: Do not create an image. Just verify that jfreechart is called
>> and verify where it would create the image . To be done with some  
>> mocks.
>> - Not as good: pass the location from the pom.xml. Actually it's
>> already passed by surefire so you just need to retrieve it as a  
>> system
>> property.
>
>
> Fixed by using "java.io.tmpdir" system property.

This is bad. For several reasons:

1) This is a unit test and it doesn't need to prove that jfreechart  
works
2) Any application that creates files a bit everywhere are very bad.  
Even if you added a remove on shutdown hook it would still be bad  
since if the application was killed there would be leftovers.
3) It's easy for a unit test to control what happens and use mocks  
where need be. It also improves the code design in general.

Thanks
-Vincent

_______________________________________________
devs mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/devs

Reply via email to