Some test cases in GeoTiffWriteReadTest fails assertion if java -enableassertions switch is turned on

I can pass all tests org.esa.snap.dataio.geotiffGeoTiffWriteReadTest from maven command line.

However, I stumbled on this problem when running org.esa.snap.dataio.geotiffGeoTiffWriteReadTest on eclipse. By default, my eclipse turns on java enable assertions switch.

When the enable assertions switch is turned on the following test cases will fail:

  • testWriteReadUTMProjection
  • testWriteReadTransverseMercator
  • testWriteReadLambertConformalConic

The same test cases will fail in maven command line if enable assertions switch is turned on through maven surefire enableAssertions flag.

The assertion is caught by:

Upon further checking, the assertion for testWriteReadUTMProjection and testWriteReadTransverseMercator were caused by the following Affine Transform operations:

while testWriteReadLambertConformalConic was caused by similar Affine Transform operations:

I could make the assertion pass for testWriteReadUTMProjection and testWriteReadTransverseMercator by reducing the Affine Transform operations to

imageToMap.translate(827933.23, 3729820.29);

However, I couldn’t find Affine Transform operation to pass the assertion for testWriteReadLambertConformalConic.

Can anyone help?

Hi,

because of the assertion we disabled them in the pom.xml.

To my understanding the assertions, used by GeoTools, are not necessary. The working test with assertions disabled, proofs this.
The assertions are also not enabled when running SNAP. So I think it is okay as it is.