aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorSamuel Tardieu <sam@rfc1149.net>2015-01-30 13:39:47 +0100
committerSamuel Tardieu <sam@rfc1149.net>2015-01-30 13:50:38 +0100
commitf657c9a7110cf97980e1d861673b6febc1cf0bbd (patch)
tree1eed0ab41d766fa7769ad5624b6029574b166935 /tests
parenta4d663735af1e853b8daf407e15059764f636cee (diff)
downloadcgeo-f657c9a7110cf97980e1d861673b6febc1cf0bbd.zip
cgeo-f657c9a7110cf97980e1d861673b6febc1cf0bbd.tar.gz
cgeo-f657c9a7110cf97980e1d861673b6febc1cf0bbd.tar.bz2
Fix URL writing in GPX export
Diffstat (limited to 'tests')
-rw-r--r--tests/src/cgeo/geocaching/export/ExportTest.java17
1 files changed, 11 insertions, 6 deletions
diff --git a/tests/src/cgeo/geocaching/export/ExportTest.java b/tests/src/cgeo/geocaching/export/ExportTest.java
index bec676f..21c45a0 100644
--- a/tests/src/cgeo/geocaching/export/ExportTest.java
+++ b/tests/src/cgeo/geocaching/export/ExportTest.java
@@ -25,7 +25,7 @@ public class ExportTest extends CGeoTestCase {
final Geocache cache = new Geocache();
cache.setGeocode("GCX1234");
final LogEntry log = new LogEntry(1353244820000L, LogType.FOUND_IT, "Hidden in a tree");
- FieldNotes fieldNotes = new FieldNotes();
+ final FieldNotes fieldNotes = new FieldNotes();
fieldNotes.add(cache, log);
assertEquals("Non matching export " + fieldNotes.getContent(), "GCX1234,2012-11-18T13:20:20Z,Found it,\"Hidden in a tree\"\n", fieldNotes.getContent());
}
@@ -55,8 +55,8 @@ public class ExportTest extends CGeoTestCase {
cache.setDetailed(true);
DataStore.saveCache(cache, LoadFlags.SAVE_ALL);
- List<Geocache> exportList = Collections.singletonList(cache);
- GpxExportTester gpxExport = new GpxExportTester();
+ final List<Geocache> exportList = Collections.singletonList(cache);
+ final GpxExportTester gpxExport = new GpxExportTester();
File result = null;
try {
result = gpxExport.testExportSync(exportList);
@@ -67,17 +67,22 @@ public class ExportTest extends CGeoTestCase {
assertThat(result).isNotNull();
// make sure we actually exported waypoints
- String gpx = org.apache.commons.io.FileUtils.readFileToString(result);
+ final String gpx = org.apache.commons.io.FileUtils.readFileToString(result);
assertThat(gpx).contains("<wpt");
assertThat(gpx).contains(cache.getGeocode());
+ if (cache.getUrl() != null) {
+ assertThat(gpx).contains("<url>");
+ } else {
+ assertThat(gpx).doesNotContain("<url>");
+ }
FileUtils.deleteIgnoringFailure(result);
}
private static class GpxExportTester extends GpxExport {
- public File testExportSync(List<Geocache> caches) throws InterruptedException, ExecutionException {
- final ArrayList<String> geocodes = new ArrayList<String>(caches.size());
+ public File testExportSync(final List<Geocache> caches) throws InterruptedException, ExecutionException {
+ final ArrayList<String> geocodes = new ArrayList<>(caches.size());
for (final Geocache cache : caches) {
geocodes.add(cache.getGeocode());
}