Index: applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/AbstractTest.java
===================================================================
--- applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/AbstractTest.java	(revision 31459)
+++ applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/AbstractTest.java	(revision 31460)
@@ -12,6 +12,4 @@
 public abstract class AbstractTest {
 
-  private static boolean started = false;
-
   /**
    * Initiates the basic parts of JOSM.
Index: applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/ImportTest.java
===================================================================
--- applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/ImportTest.java	(revision 31459)
+++ applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/ImportTest.java	(revision 31460)
@@ -10,9 +10,6 @@
 import javax.imageio.IIOException;
 
-import org.apache.commons.imaging.common.RationalNumber;
-import org.apache.commons.imaging.formats.tiff.constants.GpsTagConstants;
 import org.openstreetmap.josm.data.coor.LatLon;
 import org.openstreetmap.josm.plugins.mapillary.actions.MapillaryImportAction;
-import org.openstreetmap.josm.plugins.mapillary.utils.MapillaryUtils;
 
 /**
@@ -51,22 +48,3 @@
     img.getImage();
   }
-
-  /**
-   * Test degMinSecToDouble method.
-   */
-  @Test
-  public void degMinSecToDoubleTest() {
-    RationalNumber[] num = new RationalNumber[3];
-    num[0] = new RationalNumber(1, 1);
-    num[1] = new RationalNumber(0, 1);
-    num[2] = new RationalNumber(0, 1);
-    String ref = GpsTagConstants.GPS_TAG_GPS_LATITUDE_REF_VALUE_NORTH;
-    assertEquals(1, MapillaryUtils.degMinSecToDouble(num, ref), 0.01);
-    ref = GpsTagConstants.GPS_TAG_GPS_LATITUDE_REF_VALUE_SOUTH;
-    assertEquals(-1, MapillaryUtils.degMinSecToDouble(num, ref), 0.01);
-    num[0] = new RationalNumber(180, 1);
-    assertEquals(-180, MapillaryUtils.degMinSecToDouble(num, ref), 0.01);
-    num[0] = new RationalNumber(190, 1);
-    assertEquals(170, MapillaryUtils.degMinSecToDouble(num, ref), 0.01);
-  }
 }
Index: applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImageTest.java
===================================================================
--- applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImageTest.java	(revision 31459)
+++ applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/MapillaryAbstractImageTest.java	(revision 31460)
@@ -42,5 +42,5 @@
   }
 
-  private void testGetDate(String expected, MapillaryAbstractImage img,
+  private static void testGetDate(String expected, MapillaryAbstractImage img,
       boolean isoDates, boolean displayHour, boolean format24) {
     Main.pref.put("iso.dates", isoDates);
Index: applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/MapillaryDataTest.java
===================================================================
--- applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/MapillaryDataTest.java	(revision 31460)
+++ applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/MapillaryDataTest.java	(revision 31460)
@@ -0,0 +1,157 @@
+package org.openstreetmap.josm.plugins.mapillary;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.util.Arrays;
+
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests for {@link MapillaryData} class.
+ *
+ * @author nokutu
+ * @see MapillaryData
+ */
+public class MapillaryDataTest extends AbstractTest {
+
+  MapillaryData data;
+  MapillaryImage img1;
+  MapillaryImage img2;
+  MapillaryImage img3;
+  MapillaryImage img4;
+  MapillarySequence seq;
+
+  /**
+   * Creates a sample {@link MapillaryData} objects, 4 {@link MapillaryImage}
+   * objects and a {@link MapillarySequence} object.
+   */
+  @Before
+  public void setUp() {
+    this.img1 = new MapillaryImage("key1", 0.1, 0.1, 90);
+    this.img2 = new MapillaryImage("key2", 0.2, 0.2, 90);
+    this.img3 = new MapillaryImage("key3", 0.3, 0.3, 90);
+    this.img4 = new MapillaryImage("key4", 0.4, 0.4, 90);
+    this.seq = new MapillarySequence();
+
+    this.seq.add(Arrays.asList(new MapillaryAbstractImage[] { this.img1,
+        this.img2, this.img3, this.img4 }));
+    this.img1.setSequence(this.seq);
+    this.img2.setSequence(this.seq);
+    this.img3.setSequence(this.seq);
+    this.img4.setSequence(this.seq);
+
+    this.data = new MapillaryData();
+    this.data.add(this.seq.getImages());
+  }
+
+  /**
+   * Tests the addition of new images. If a second image with the same key as
+   * another one in the database, the one that is being added should be ignored.
+   */
+  @Test
+  public void addTest() {
+    this.data = new MapillaryData();
+    assertEquals(0, this.data.getImages().size());
+    this.data.add(this.img1);
+    assertEquals(1, this.data.getImages().size());
+    this.data.add(this.img1);
+    assertEquals(1, this.data.getImages().size());
+    this.data.add(Arrays.asList(new MapillaryAbstractImage[] { this.img2,
+        this.img3 }));
+    assertEquals(3, this.data.getImages().size());
+    this.data.add(Arrays.asList(new MapillaryAbstractImage[] { this.img3,
+        this.img4 }));
+    assertEquals(4, this.data.getImages().size());
+  }
+
+  /**
+   * Test that the size is properly calculated.
+   */
+  @Test
+  public void sizeTest() {
+    assertEquals(4, this.data.size());
+    this.data.add(new MapillaryImage("key5", 0.1, 0.1, 90));
+    assertEquals(5, this.data.size());
+  }
+
+  /**
+   * Test the {@link MapillaryData#setHighlightedImage(MapillaryAbstractImage)}
+   * and {@link MapillaryData#getHighlightedImage()} methods.
+   */
+  @Test
+  public void highlighTest() {
+    this.data.setHighlightedImage(this.img1);
+    assertEquals(this.img1, this.data.getHighlightedImage());
+
+    this.data.setHighlightedImage(null);
+    assertEquals(null, this.data.getHighlightedImage());
+  }
+
+  /**
+   * Tests the selection of images.
+   */
+  @Test
+  public void selectTest() {
+    this.data.setSelectedImage(this.img1);
+    assertEquals(this.img1, this.data.getSelectedImage());
+
+    this.data.setSelectedImage(this.img4);
+    assertEquals(this.img4, this.data.getSelectedImage());
+
+    this.data.setSelectedImage(null);
+    assertEquals(null, this.data.getSelectedImage());
+  }
+
+  /**
+   * Tests the {@link MapillaryData#selectNext()} and
+   * {@link MapillaryData#selectPrevious()} methods.
+   */
+  @Test
+  public void NextAndPreviousTest() {
+    this.data.setSelectedImage(this.img1);
+
+    this.data.selectNext();
+    assertEquals(this.img2, this.data.getSelectedImage());
+    this.data.selectNext();
+    assertEquals(this.img3, this.data.getSelectedImage());
+    this.data.selectPrevious();
+    assertEquals(this.img2, this.data.getSelectedImage());
+
+    this.data.setSelectedImage(null);
+    // Test IllegalStateException thrown by selectNext() when the selectedImage
+    // is null.
+    try {
+      this.data.selectNext();
+      fail();
+    } catch (IllegalStateException e) {
+    } catch (Exception e) {
+      fail();
+    }
+    // Test IllegalStateException thrown by selectPrevious() when the
+    // selectedImage is null.
+    try {
+      this.data.selectPrevious();
+      fail();
+    } catch (IllegalStateException e) {
+    } catch (Exception e) {
+      fail();
+    }
+  }
+
+  /**
+   * Test the multiselection of images. When a new image is selected, the
+   * multiselected List should reset.
+   */
+  @Test
+  public void multiSelectTest() {
+    assertEquals(0, this.data.getMultiSelectedImages().size());
+    this.data.setSelectedImage(this.img1);
+    assertEquals(1, this.data.getMultiSelectedImages().size());
+    this.data.addMultiSelectedImage(this.img2);
+    assertEquals(2, this.data.getMultiSelectedImages().size());
+    this.data.setSelectedImage(this.img1);
+    assertEquals(1, this.data.getMultiSelectedImages().size());
+  }
+}
Index: applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/MapillarySequenceTest.java
===================================================================
--- applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/MapillarySequenceTest.java	(revision 31460)
+++ applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/MapillarySequenceTest.java	(revision 31460)
@@ -0,0 +1,81 @@
+package org.openstreetmap.josm.plugins.mapillary;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
+
+import java.util.Arrays;
+
+import org.junit.Before;
+import org.junit.Test;
+
+/**
+ * Tests for the {@link MapillarySequence} class.
+ *
+ * @author nokutu
+ * @see MapillarySequence
+ */
+public class MapillarySequenceTest {
+
+  MapillaryImage img1;
+  MapillaryImage img2;
+  MapillaryImage img3;
+  MapillaryImage img4;
+  MapillarySequence seq;
+
+  /**
+   * Creates 4 {@link MapillaryImage} objects and puts them in a
+   * {@link MapillarySequence} object.
+   */
+  @Before
+  public void setUp() {
+    this.img1 = new MapillaryImage("key1", 0.1, 0.1, 90);
+    this.img2 = new MapillaryImage("key2", 0.2, 0.2, 90);
+    this.img3 = new MapillaryImage("key3", 0.3, 0.3, 90);
+    this.img4 = new MapillaryImage("key4", 0.4, 0.4, 90);
+    this.seq = new MapillarySequence();
+
+    this.seq.add(Arrays.asList(new MapillaryAbstractImage[] { this.img1,
+        this.img2, this.img3, this.img4 }));
+    this.img1.setSequence(this.seq);
+    this.img2.setSequence(this.seq);
+    this.img3.setSequence(this.seq);
+    this.img4.setSequence(this.seq);
+  }
+
+  /**
+   * Tests the {@link MapillarySequence#next(MapillaryAbstractImage)} and
+   * {@link MapillarySequence#previous(MapillaryAbstractImage)}.
+   */
+  @Test
+  public void nextAndPreviousTest() {
+    assertEquals(this.img2, this.img1.next());
+    assertEquals(this.img2, this.seq.next(this.img1));
+
+    assertEquals(this.img1, this.img2.previous());
+    assertEquals(this.img1, this.seq.previous(this.img2));
+
+    assertEquals(null, this.img4.next());
+    assertEquals(null, this.seq.next(this.img4));
+    assertEquals(null, this.img1.previous());
+    assertEquals(null, this.seq.previous(this.img1));
+
+    // Test IllegalArgumentException when asking for the next image of an image
+    // that is not in the sequence.
+    try {
+      this.seq.next(new MapillaryImage("key5", 0.5, 0.5, 90));
+      fail();
+    } catch (IllegalArgumentException e) {
+    } catch (Exception e) {
+      fail();
+    }
+    // Test IllegalArgumentException when asking for the previous image of an
+    // image that is not in the sequence.
+    try {
+      this.seq.previous(new MapillaryImage("key5", 0.5, 0.5, 90));
+      fail();
+    } catch (IllegalArgumentException e) {
+    } catch (Exception e) {
+      fail();
+    }
+  }
+}
Index: applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/UploadTest.java
===================================================================
--- applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/UploadTest.java	(revision 31459)
+++ 	(revision )
@@ -1,72 +1,0 @@
-package org.openstreetmap.josm.plugins.mapillary;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-
-import java.io.File;
-import java.io.IOException;
-
-import org.apache.commons.imaging.ImageReadException;
-import org.apache.commons.imaging.ImageWriteException;
-import org.apache.commons.imaging.Imaging;
-import org.apache.commons.imaging.common.ImageMetadata;
-import org.apache.commons.imaging.common.RationalNumber;
-import org.apache.commons.imaging.formats.jpeg.JpegImageMetadata;
-import org.apache.commons.imaging.formats.tiff.constants.ExifTagConstants;
-import org.apache.commons.imaging.formats.tiff.constants.GpsTagConstants;
-import org.junit.Test;
-import org.openstreetmap.josm.data.coor.LatLon;
-import org.openstreetmap.josm.plugins.mapillary.actions.MapillaryImportAction;
-import org.openstreetmap.josm.plugins.mapillary.oauth.UploadUtils;
-import org.openstreetmap.josm.plugins.mapillary.utils.MapillaryUtils;
-
-public class UploadTest extends AbstractTest {
-
-  /**
-   * Tests the updateFile method from {@link MapillaryImportAction} class.
-   */
-  @Test
-  public void updateFileTest() {
-    File image = new File("images/icon16.png");
-    MapillaryImportedImage img = new MapillaryImportAction().readNoTags(image,
-        new LatLon(0, 0));
-    File updatedFile = null;
-    try {
-      updatedFile = UploadUtils.updateFile(img);
-      ImageMetadata metadata = Imaging.getMetadata(updatedFile);
-      final JpegImageMetadata jpegMetadata = (JpegImageMetadata) metadata;
-      assertTrue(jpegMetadata
-          .findEXIFValueWithExactMatch(GpsTagConstants.GPS_TAG_GPS_LATITUDE_REF) != null);
-      assertTrue(jpegMetadata
-          .findEXIFValueWithExactMatch(GpsTagConstants.GPS_TAG_GPS_LATITUDE) != null);
-      assertTrue(jpegMetadata
-          .findEXIFValueWithExactMatch(GpsTagConstants.GPS_TAG_GPS_LONGITUDE_REF) != null);
-      assertTrue(jpegMetadata
-          .findEXIFValueWithExactMatch(GpsTagConstants.GPS_TAG_GPS_LONGITUDE) != null);
-      assertTrue(jpegMetadata
-          .findEXIFValueWithExactMatch(GpsTagConstants.GPS_TAG_GPS_IMG_DIRECTION) != null);
-      assertTrue(jpegMetadata
-          .findEXIFValueWithExactMatch(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL) != null);
-      assertEquals(0, MapillaryUtils.degMinSecToDouble(
-          (RationalNumber[]) jpegMetadata.findEXIFValueWithExactMatch(
-              GpsTagConstants.GPS_TAG_GPS_LATITUDE).getValue(),
-          jpegMetadata
-              .findEXIFValueWithExactMatch(
-                  GpsTagConstants.GPS_TAG_GPS_LATITUDE_REF).getValue()
-              .toString()), 0.01);
-      assertEquals(0, MapillaryUtils.degMinSecToDouble(
-          (RationalNumber[]) jpegMetadata.findEXIFValueWithExactMatch(
-              GpsTagConstants.GPS_TAG_GPS_LONGITUDE).getValue(),
-          jpegMetadata
-              .findEXIFValueWithExactMatch(
-                  GpsTagConstants.GPS_TAG_GPS_LONGITUDE_REF).getValue()
-              .toString()), 0.01);
-
-    } catch (ImageReadException | ImageWriteException | IOException e) {
-      fail();
-    } finally {
-      updatedFile.delete();
-    }
-  }
-}
Index: applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/oauth/UploadTest.java
===================================================================
--- applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/oauth/UploadTest.java	(revision 31460)
+++ applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/oauth/UploadTest.java	(revision 31460)
@@ -0,0 +1,80 @@
+package org.openstreetmap.josm.plugins.mapillary.oauth;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.apache.commons.imaging.ImageReadException;
+import org.apache.commons.imaging.ImageWriteException;
+import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.common.ImageMetadata;
+import org.apache.commons.imaging.common.RationalNumber;
+import org.apache.commons.imaging.formats.jpeg.JpegImageMetadata;
+import org.apache.commons.imaging.formats.tiff.constants.ExifTagConstants;
+import org.apache.commons.imaging.formats.tiff.constants.GpsTagConstants;
+import org.junit.Test;
+import org.openstreetmap.josm.data.coor.LatLon;
+import org.openstreetmap.josm.plugins.mapillary.AbstractTest;
+import org.openstreetmap.josm.plugins.mapillary.MapillaryImportedImage;
+import org.openstreetmap.josm.plugins.mapillary.actions.MapillaryImportAction;
+import org.openstreetmap.josm.plugins.mapillary.oauth.UploadUtils;
+import org.openstreetmap.josm.plugins.mapillary.utils.MapillaryUtils;
+
+/**
+ * Tests the {@link UploadUtils} class.
+ *
+ * @author nokutu
+ * @see UploadUtils
+ */
+public class UploadTest extends AbstractTest {
+
+  /**
+   * Tests the {@link UploadUtils#updateFile(MapillaryImportedImage)} method.
+   */
+  @Test
+  public void updateFileTest() {
+    File image = new File("images/icon16.png");
+    MapillaryImportedImage img = new MapillaryImportAction().readNoTags(image,
+        new LatLon(0, 0));
+    File updatedFile = null;
+    try {
+      updatedFile = UploadUtils.updateFile(img);
+      ImageMetadata metadata = Imaging.getMetadata(updatedFile);
+      final JpegImageMetadata jpegMetadata = (JpegImageMetadata) metadata;
+      assertTrue(jpegMetadata
+          .findEXIFValueWithExactMatch(GpsTagConstants.GPS_TAG_GPS_LATITUDE_REF) != null);
+      assertTrue(jpegMetadata
+          .findEXIFValueWithExactMatch(GpsTagConstants.GPS_TAG_GPS_LATITUDE) != null);
+      assertTrue(jpegMetadata
+          .findEXIFValueWithExactMatch(GpsTagConstants.GPS_TAG_GPS_LONGITUDE_REF) != null);
+      assertTrue(jpegMetadata
+          .findEXIFValueWithExactMatch(GpsTagConstants.GPS_TAG_GPS_LONGITUDE) != null);
+      assertTrue(jpegMetadata
+          .findEXIFValueWithExactMatch(GpsTagConstants.GPS_TAG_GPS_IMG_DIRECTION) != null);
+      assertTrue(jpegMetadata
+          .findEXIFValueWithExactMatch(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL) != null);
+      assertEquals(0, MapillaryUtils.degMinSecToDouble(
+          (RationalNumber[]) jpegMetadata.findEXIFValueWithExactMatch(
+              GpsTagConstants.GPS_TAG_GPS_LATITUDE).getValue(),
+          jpegMetadata
+              .findEXIFValueWithExactMatch(
+                  GpsTagConstants.GPS_TAG_GPS_LATITUDE_REF).getValue()
+              .toString()), 0.01);
+      assertEquals(0, MapillaryUtils.degMinSecToDouble(
+          (RationalNumber[]) jpegMetadata.findEXIFValueWithExactMatch(
+              GpsTagConstants.GPS_TAG_GPS_LONGITUDE).getValue(),
+          jpegMetadata
+              .findEXIFValueWithExactMatch(
+                  GpsTagConstants.GPS_TAG_GPS_LONGITUDE_REF).getValue()
+              .toString()), 0.01);
+
+    } catch (ImageReadException | ImageWriteException | IOException e) {
+      fail();
+    } finally {
+      updatedFile.delete();
+    }
+  }
+}
Index: applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryUtilsTest.java
===================================================================
--- applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryUtilsTest.java	(revision 31460)
+++ applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/MapillaryUtilsTest.java	(revision 31460)
@@ -0,0 +1,37 @@
+package org.openstreetmap.josm.plugins.mapillary.utils;
+
+import static org.junit.Assert.assertEquals;
+
+import org.apache.commons.imaging.common.RationalNumber;
+import org.apache.commons.imaging.formats.tiff.constants.GpsTagConstants;
+import org.junit.Test;
+
+/**
+ * Tests the static methods of the class {@link MapillaryUtils}
+ *
+ * @see MapillaryUtils
+ * @author nokutu
+ *
+ */
+public class MapillaryUtilsTest {
+
+  /**
+   * Test {@link MapillaryUtils#degMinSecToDouble(RationalNumber[], String)}
+   * method.
+   */
+  @Test
+  public void degMinSecToDoubleTest() {
+    RationalNumber[] num = new RationalNumber[3];
+    num[0] = new RationalNumber(1, 1);
+    num[1] = new RationalNumber(0, 1);
+    num[2] = new RationalNumber(0, 1);
+    String ref = GpsTagConstants.GPS_TAG_GPS_LATITUDE_REF_VALUE_NORTH;
+    assertEquals(1, MapillaryUtils.degMinSecToDouble(num, ref), 0.01);
+    ref = GpsTagConstants.GPS_TAG_GPS_LATITUDE_REF_VALUE_SOUTH;
+    assertEquals(-1, MapillaryUtils.degMinSecToDouble(num, ref), 0.01);
+    num[0] = new RationalNumber(180, 1);
+    assertEquals(-180, MapillaryUtils.degMinSecToDouble(num, ref), 0.01);
+    num[0] = new RationalNumber(190, 1);
+    assertEquals(170, MapillaryUtils.degMinSecToDouble(num, ref), 0.01);
+  }
+}
Index: applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/TestUtil.java
===================================================================
--- applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/TestUtil.java	(revision 31459)
+++ applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/utils/TestUtil.java	(revision 31460)
@@ -1,12 +1,8 @@
 package org.openstreetmap.josm.plugins.mapillary.utils;
 
-import java.io.File;
 
 import org.openstreetmap.josm.Main;
 import org.openstreetmap.josm.data.projection.Projections;
-import org.openstreetmap.josm.plugins.PluginException;
-import org.openstreetmap.josm.plugins.PluginInformation;
 import org.openstreetmap.josm.plugins.mapillary.MapillaryLayer;
-import org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin;
 import org.openstreetmap.josm.tools.I18n;
 
