Index: trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImagesTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImagesTest.java	(revision 9383)
+++ trunk/test/unit/org/openstreetmap/josm/gui/layer/geoimage/CorrelateGpxWithImagesTest.java	(revision 9384)
@@ -2,18 +2,59 @@
 package org.openstreetmap.josm.gui.layer.geoimage;
 
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
 
+import java.util.Arrays;
+import java.util.TimeZone;
+
+import org.junit.BeforeClass;
 import org.junit.Test;
+import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.data.gpx.GpxData;
 import org.openstreetmap.josm.io.GpxReaderTest;
+import org.openstreetmap.josm.tools.date.DateUtils;
 
+/**
+ * Unit tests of {@link CorrelateGpxWithImagesTest} class.
+ */
 public class CorrelateGpxWithImagesTest {
 
+    /**
+     * Setup test.
+     */
+    @BeforeClass
+    public static void setUp() {
+        TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
+    }
+
+    /**
+     * Tests matching of images to a GPX track.
+     * @throws Exception if the track cannot be parsed
+     */
     @Test
     public void testMatchGpxTrack() throws Exception {
-        final GpxData munich = GpxReaderTest.parseGpxData("data_nodist/munich.gpx");
+        final GpxData gpx = GpxReaderTest.parseGpxData("data_nodist/2094047.gpx");
+        assertEquals(4, gpx.tracks.size());
+        assertEquals(1, gpx.tracks.iterator().next().getSegments().size());
+        assertEquals(185, gpx.tracks.iterator().next().getSegments().iterator().next().getWayPoints().size());
+
+        final ImageEntry i0 = new ImageEntry();
+        i0.setExifTime(DateUtils.fromString("2016:01:03 11:59:54")); // 4 sec before start of GPX
+        i0.createTmp();
         final ImageEntry i1 = new ImageEntry();
-        i1.setExifGpsTime();
-        CorrelateGpxWithImages.matchGpxTrack(null, munich, 0);
+        i1.setExifTime(DateUtils.fromString("2016:01:03 12:04:01"));
+        i1.createTmp();
+        final ImageEntry i2 = new ImageEntry();
+        i2.setExifTime(DateUtils.fromString("2016:01:03 12:04:57"));
+        i2.createTmp();
+        final ImageEntry i3 = new ImageEntry();
+        i3.setExifTime(DateUtils.fromString("2016:01:03 12:05:05"));
+        i3.createTmp();
+
+        assertEquals(4, CorrelateGpxWithImages.matchGpxTrack(Arrays.asList(i0, i1, i2, i3), gpx, 0));
+        assertEquals(new LatLon(47.19286847859621, 8.79732714034617), i0.getPos()); // start of track
+        assertEquals(new LatLon(47.196979885920882, 8.79541271366179), i1.getPos()); // exact match
+        assertEquals(new LatLon(47.197319911792874, 8.792139580473304), i3.getPos()); // exact match
+        assertEquals(new LatLon((47.197131179273129 + 47.197186248376966) / 2, (8.792974585667253 + 8.792809881269932) / 2),
+                i2.getPos()); // interpolated
     }
 }
Index: trunk/test/unit/org/openstreetmap/josm/io/GpxReaderTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/GpxReaderTest.java	(revision 9383)
+++ trunk/test/unit/org/openstreetmap/josm/io/GpxReaderTest.java	(revision 9384)
@@ -8,4 +8,5 @@
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.IOException;
 import java.nio.charset.StandardCharsets;
 import java.util.List;
@@ -23,4 +24,21 @@
 
     /**
+     * Parses a GPX file and returns the parsed data
+     * @param filename the GPX file to parse
+     * @return the parsed GPX data
+     * @throws IOException if an error occurs during reading.
+     * @throws SAXException if a SAX error occurs
+     */
+    public static GpxData parseGpxData(String filename) throws IOException, SAXException {
+        final GpxData result;
+        try (final FileInputStream in = new FileInputStream(new File(filename))) {
+            final GpxReader reader = new GpxReader(in);
+            assertTrue(reader.parse(false));
+            result = reader.getGpxData();
+        }
+        return result;
+    }
+
+    /**
      * Tests the {@code munich.gpx} test file.
      * @throws Exception if something goes wrong
@@ -28,10 +46,5 @@
     @Test
     public void testMunich() throws Exception {
-        final GpxData result;
-        try (final FileInputStream in = new FileInputStream(new File("data_nodist/munich.gpx"))) {
-            final GpxReader reader = new GpxReader(in);
-            assertTrue(reader.parse(false));
-            result = reader.getGpxData();
-        }
+        final GpxData result = parseGpxData("data_nodist/munich.gpx");
         assertEquals(2762, result.tracks.size());
         assertEquals(0, result.routes.size());
