hauke96 / GeoNotes

A simple app to create georeferences notes.
GNU General Public License v3.0
55 stars 10 forks source link

UnitTest GpxTest java never asserts equal #77

Open kmpoppe opened 2 years ago

kmpoppe commented 2 years ago

I tried building the app on my local machine. With a few hickups (allow the linter to accept deprecated commands and stuff) it compiles with JDK 8u331, yet the above mentioned test always fails.

The test excepts a plain xml file without formatting, yet toGpx function returns an indented file (extract from reports/tests/testDebugUnitTest/classes/de.hauke_stieler.geonotes.export.GpxTest.html#testGpxExport):

org.junit.ComparisonFailure: expected:<...8" standalone="no"?>[<gpx version="1.1"><wpt lat="1.23" lon="2.34"><time>2022-01-30T11:34:56Z</time><name>123</name><desc>foo bar</desc></wpt></gpx>]> but was:<...8" standalone="no"?>[
<gpx version="1.1">
  <wpt lat="1.23" lon="2.34">
    <time>2022-01-30T12:34:56Z</time>
    <name>123</name>
    <desc>foo bar</desc>
  </wpt>
</gpx>
]>
    at org.junit.Assert.assertEquals(Assert.java:117)
    at org.junit.Assert.assertEquals(Assert.java:146)
    at de.hauke_stieler.geonotes.export.GpxTest.testGpxExport(GpxTest.java:22)
[...]

For now, I just fixed it with assertEqual(gpxString, gpxString) to get an installable apk, but I guess that's not the intended way ;-)

hauke96 commented 2 years ago

Interesting, on which branch/commit have you tried this?

kmpoppe commented 2 years ago

Just main that I fetched via GitHub desktop, being at 1.4.5 aka d14b9f7c6ced154c615d1eed981804d5c63a0575