Unit test failure in ImageMosaicFormatFactoryTest.testSystemLoaderUnbounded() 
caused by test order assumption
-------------------------------------------------------------------------------------------------------------

                 Key: GEOT-3193
                 URL: http://jira.codehaus.org/browse/GEOT-3193
             Project: GeoTools
          Issue Type: Bug
          Components: gc imagemosaic
            Reporter: Ben Caradoc-Davies


ImageMosaicFormatFactoryTest.testSystemLoaderUnbounded() sets a system property 
to trigger the loading of a configuration property file in the static 
initialiser of ImageMosaicFormatFactory:
{code}
System.setProperty("mosaic.threadpoolconfig.path", file.getAbsolutePath());
{code}

Setting the system property has the nasty side-effect of modifying the 
behaviour of the static initialiser of ImageMosaicFormatFactory if and only if 
the static initialiser has not yet been called (i.e. the class has not been 
loaded in the test runner JVM). As a consequence, if 
ImageMosaicFormatFactoryTest is run by itself, it passes. If run after another 
test such as GranuleTest that causes ImageMosaicFormatFactory to be loaded, 
this test will fail because the static initialiser has already run, parameters 
are already set to hardcoded defaults, and the property file is never used.

Setting a system property from within a unit test is a bad practice because it 
causes unit tests to no longer be independent. Needing to do this suggests 
ImageMosaicFormatFactory should be refactored to improve testability.

I have disabled this test by adding a n...@ignore annotation in r35906 on trunk 
and r35907 on 2.6.x to fix the build. (This is why this issue is not a blocker.)


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Geotools-devel mailing list
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to