Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java	(revision 31416)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/MapillaryPlugin.java	(revision 31417)
@@ -1,4 +1,5 @@
 package org.openstreetmap.josm.plugins.mapillary;
 
+import java.io.File;
 import java.io.IOException;
 
@@ -31,19 +32,18 @@
 public class MapillaryPlugin extends Plugin {
 
+  /** Plugin's directory */
+  public static String directory;
   /** 24x24 icon. */
-  public static final ImageIcon ICON24 = new ImageProvider("icon24.png").get();
+  public static ImageIcon ICON24;
   /** 16x16 icon. */
-  public static final ImageIcon ICON16 = new ImageProvider("icon16.png").get();
+  public static ImageIcon ICON16;
   /** Icon representing an image in the map. */
-  public static final ImageIcon MAP_ICON = new ImageProvider("mapicon.png")
-      .get();
+  public static ImageIcon MAP_ICON;
   /** Icon representing a selected image in the map. */
-  public static final ImageIcon MAP_ICON_SELECTED = new ImageProvider(
-      "mapiconselected.png").get();
+  public static ImageIcon MAP_ICON_SELECTED;
   /** Icon representing an imported image in the map. */
-  public static final ImageIcon MAP_ICON_IMPORTED = new ImageProvider(
-      "mapiconimported.png").get();
+  public static ImageIcon MAP_ICON_IMPORTED;
   /** Icon used to identify which images have signs on them */
-  public static final ImageIcon MAP_SIGN = new ImageProvider("sign.png").get();
+  public static ImageIcon MAP_SIGN;
 
   /** Cache that stores the pictures the downloaded pictures. */
@@ -52,5 +52,5 @@
   private final MapillaryDownloadAction downloadAction;
   private final MapillaryExportAction exportAction;
-  private final MapillaryImportAction importAction;
+  public static MapillaryImportAction importAction;
   private final MapillaryZoomAction zoomAction;
   private final MapillaryDownloadViewAction downloadViewAction;
@@ -58,5 +58,5 @@
   private final MapillaryJoinAction joinAction;
   /** Walk action */
-  public final static MapillaryWalkAction walkAction = new MapillaryWalkAction();
+  public static MapillaryWalkAction walkAction;
 
   /** Menu button for the {@link MapillaryDownloadAction} action. */
@@ -84,5 +84,17 @@
   public MapillaryPlugin(PluginInformation info) {
     super(info);
+
+    directory = new File("").getAbsolutePath() + "/";
+    ICON24 = new ImageProvider(directory + "images/icon24.png").get();
+    ICON16 = new ImageProvider(directory + "images/icon16.png").get();
+    MAP_ICON = new ImageProvider(directory + "images/mapicon.png").get();
+    MAP_ICON_SELECTED = new ImageProvider(directory
+        + "images/mapiconselected.png").get();
+    MAP_ICON_IMPORTED = new ImageProvider(directory
+        + "images/mapiconimported.png").get();
+    MAP_SIGN = new ImageProvider(directory + "images/sign.png").get();
+
     downloadAction = new MapillaryDownloadAction();
+    walkAction = new MapillaryWalkAction();
     exportAction = new MapillaryExportAction();
     importAction = new MapillaryImportAction();
@@ -106,14 +118,14 @@
       JOIN_MENU = MainMenu.add(Main.main.menu.dataMenu, joinAction, false);
       WALK_MENU = MainMenu.add(Main.main.menu.moreToolsMenu, walkAction, false);
+
+      EXPORT_MENU.setEnabled(false);
+      DOWNLOAD_MENU.setEnabled(false);
+      IMPORT_MENU.setEnabled(false);
+      IMPORT_INTO_SEQUENCE_MENU.setEnabled(false);
+      ZOOM_MENU.setEnabled(false);
+      DOWNLOAD_VIEW_MENU.setEnabled(false);
+      JOIN_MENU.setEnabled(false);
+      WALK_MENU.setEnabled(false);
     }
-
-    EXPORT_MENU.setEnabled(false);
-    DOWNLOAD_MENU.setEnabled(false);
-    IMPORT_MENU.setEnabled(false);
-    IMPORT_INTO_SEQUENCE_MENU.setEnabled(false);
-    ZOOM_MENU.setEnabled(false);
-    DOWNLOAD_VIEW_MENU.setEnabled(false);
-    JOIN_MENU.setEnabled(false);
-    WALK_MENU.setEnabled(false);
 
     try {
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadAction.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadAction.java	(revision 31416)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadAction.java	(revision 31417)
@@ -12,4 +12,5 @@
 import org.openstreetmap.josm.actions.JosmAction;
 import org.openstreetmap.josm.plugins.mapillary.MapillaryLayer;
+import org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin;
 import org.openstreetmap.josm.tools.ImageProvider;
 import org.openstreetmap.josm.tools.Shortcut;
@@ -30,5 +31,5 @@
    */
   public MapillaryDownloadAction() {
-    super(tr("Mapillary"), new ImageProvider("icon24.png"),
+    super(tr("Mapillary"), new ImageProvider(MapillaryPlugin.directory + "images/icon24.png"),
         tr("Create Mapillary layer"), Shortcut.registerShortcut("Mapillary",
             tr("Start Mapillary layer"), KeyEvent.VK_COMMA, Shortcut.SHIFT),
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadViewAction.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadViewAction.java	(revision 31416)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryDownloadViewAction.java	(revision 31417)
@@ -11,4 +11,5 @@
 import org.openstreetmap.josm.actions.JosmAction;
 import org.openstreetmap.josm.plugins.mapillary.MapillaryLayer;
+import org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin;
 import org.openstreetmap.josm.plugins.mapillary.downloads.MapillaryDownloader;
 import org.openstreetmap.josm.tools.ImageProvider;
@@ -34,5 +35,5 @@
   public MapillaryDownloadViewAction() {
     super(tr("Download Mapillary images in current view"), new ImageProvider(
-        "icon24.png"), tr("Download Mapillary images in current view"),
+        MapillaryPlugin.directory + "images/icon24.png"), tr("Download Mapillary images in current view"),
         Shortcut.registerShortcut("Mapillary area",
             tr("Download Mapillary images in current view"),
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryExportAction.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryExportAction.java	(revision 31416)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryExportAction.java	(revision 31417)
@@ -21,4 +21,5 @@
 import org.openstreetmap.josm.plugins.mapillary.MapillaryImage;
 import org.openstreetmap.josm.plugins.mapillary.MapillaryImportedImage;
+import org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin;
 import org.openstreetmap.josm.plugins.mapillary.downloads.MapillaryExportManager;
 import org.openstreetmap.josm.plugins.mapillary.gui.MapillaryExportDialog;
@@ -42,5 +43,5 @@
    */
   public MapillaryExportAction() {
-    super(tr("Export pictures"), new ImageProvider("icon24.png"),
+    super(tr("Export pictures"), new ImageProvider(MapillaryPlugin.directory + "images/icon24.png"),
         tr("Export pictures"), Shortcut.registerShortcut("Export Mapillary",
             tr("Export Mapillary pictures"), KeyEvent.CHAR_UNDEFINED,
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportAction.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportAction.java	(revision 31416)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportAction.java	(revision 31417)
@@ -25,4 +25,5 @@
 import org.openstreetmap.josm.plugins.mapillary.MapillaryImportedImage;
 import org.openstreetmap.josm.plugins.mapillary.MapillaryLayer;
+import org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin;
 import org.openstreetmap.josm.tools.ImageProvider;
 import org.openstreetmap.josm.tools.Shortcut;
@@ -49,5 +50,5 @@
    */
   public MapillaryImportAction() {
-    super(tr("Import pictures"), new ImageProvider("icon24.png"),
+    super(tr("Import pictures"), new ImageProvider(MapillaryPlugin.directory + "images/icon24.png"),
         tr("Import local pictures"), Shortcut.registerShortcut(
             "Import Mapillary", tr("Import pictures into Mapillary layer"),
@@ -85,8 +86,8 @@
             try {
               if (extension.equals("jpg") || extension.equals("jpeg"))
-                readJPG(file.listFiles()[j]);
+                MapillaryData.getInstance().add(readJPG(file.listFiles()[j]));
 
               else if (extension.equals("png"))
-                readPNG(file.listFiles()[j]);
+                MapillaryData.getInstance().add(readPNG(file.listFiles()[j]));
             } catch (ImageReadException | IOException | NullPointerException e1) {
               Main.error(e1);
@@ -99,5 +100,5 @@
                   .equals(".jpeg")) {
             try {
-              readJPG(file);
+              MapillaryData.getInstance().add(readJPG(file));
             } catch (ImageReadException ex) {
               Main.error(ex);
@@ -107,20 +108,24 @@
           } else if (file.getPath().substring(file.getPath().length() - 4)
               .equals(".png")) {
-            readPNG(file);
+            MapillaryData.getInstance().add(readPNG(file));
           }
         }
       }
-    }
-  }
-
-  /**
-   * Reads a jpg pictures that contains the needed GPS information (position and
+      MapillaryLayer.getInstance().showAllPictures();
+
+    }
+  }
+
+  /**
+   * Reads a JPG pictures that contains the needed GPS information (position and
    * direction) and creates a new icon in that position.
    *
    * @param file
+   * @return The imported image.
    * @throws ImageReadException
    * @throws IOException
    */
-  public void readJPG(File file) throws ImageReadException, IOException {
+  public MapillaryImportedImage readJPG(File file) throws ImageReadException,
+      IOException {
     final ImageMetadata metadata = Imaging.getMetadata(file);
     if (metadata instanceof JpegImageMetadata) {
@@ -139,6 +144,5 @@
           .findEXIFValueWithExactMatch(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL);
       if (lat_ref == null || lat == null || lon == null || lon_ref == null) {
-        readNoTags(file);
-        return;
+        return readNoTags(file);
       }
       double latValue = 0;
@@ -154,13 +158,10 @@
         caValue = ((RationalNumber) ca.getValue()).doubleValue();
       if (datetimeOriginal != null)
-        MapillaryData.getInstance().add(
-            new MapillaryImportedImage(latValue, lonValue, caValue, file,
-                datetimeOriginal.getStringValue()));
+        return new MapillaryImportedImage(latValue, lonValue, caValue, file,
+            datetimeOriginal.getStringValue());
       else
-        MapillaryData.getInstance().add(
-            new MapillaryImportedImage(latValue, lonValue, caValue, file));
-    }
-
-    MapillaryLayer.getInstance().showAllPictures();
+        return new MapillaryImportedImage(latValue, lonValue, caValue, file);
+    }
+    throw new IllegalStateException("Invalid format.");
   }
 
@@ -170,6 +171,7 @@
    *
    * @param file
-   */
-  private void readNoTags(File file) {
+   * @return The imported image.
+   */
+  public MapillaryImportedImage readNoTags(File file) {
     double HORIZONTAL_DISTANCE = 0.0001;
     double horDev;
@@ -180,11 +182,16 @@
     LatLon pos = Main.map.mapView.getProjection().eastNorth2latlon(
         Main.map.mapView.getCenter());
-    MapillaryData.getInstance().add(
-        new MapillaryImportedImage(pos.lat(), pos.lon() + horDev, 0, file));
     noTagsPics++;
-  }
-
-  private void readPNG(File file) {
-    readNoTags(file);
+    return new MapillaryImportedImage(pos.lat(), pos.lon() + horDev, 0, file);
+  }
+
+  /**
+   * Reads an image in PNG format.
+   *
+   * @param file
+   * @return The imported image.
+   */
+  public MapillaryImportedImage readPNG(File file) {
+    return readNoTags(file);
   }
 
@@ -219,6 +226,10 @@
   public static double degMinSecToDouble(RationalNumber[] degMinSec, String ref) {
     if (degMinSec == null || degMinSec.length != 3) {
-      throw new IllegalArgumentException();
-    }
+      throw new IllegalArgumentException("Array's length must be 3.");
+    }
+    for (int i = 0; i < 3; i++)
+      if (degMinSec[i] == null)
+        throw new IllegalArgumentException("Null value in array.");
+
     switch (ref) {
       case GpsTagConstants.GPS_TAG_GPS_LATITUDE_REF_VALUE_NORTH:
@@ -228,5 +239,5 @@
         break;
       default:
-        throw new IllegalArgumentException();
+        throw new IllegalArgumentException("Invalid ref.");
     }
 
@@ -235,4 +246,11 @@
     result += degMinSec[2].doubleValue() / 3600; // seconds
 
+    while (result >= 180) {
+      result -= 180;
+    }
+    while (result <= -180) {
+      result += 180;
+    }
+
     if (GpsTagConstants.GPS_TAG_GPS_LATITUDE_REF_VALUE_SOUTH.equals(ref)
         || GpsTagConstants.GPS_TAG_GPS_LONGITUDE_REF_VALUE_WEST.equals(ref)) {
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportIntoSequenceAction.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportIntoSequenceAction.java	(revision 31416)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryImportIntoSequenceAction.java	(revision 31417)
@@ -28,4 +28,5 @@
 import org.openstreetmap.josm.plugins.mapillary.MapillaryImportedImage;
 import org.openstreetmap.josm.plugins.mapillary.MapillaryLayer;
+import org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin;
 import org.openstreetmap.josm.plugins.mapillary.MapillarySequence;
 import org.openstreetmap.josm.tools.ImageProvider;
@@ -50,5 +51,5 @@
    */
   public MapillaryImportIntoSequenceAction() {
-    super(tr("Import pictures into sequence"), new ImageProvider("icon24.png"),
+    super(tr("Import pictures into sequence"), new ImageProvider(MapillaryPlugin.directory + "images/icon24.png"),
         tr("Import local pictures"), Shortcut.registerShortcut(
             "Import Mapillary Sequence",
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryJoinAction.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryJoinAction.java	(revision 31416)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryJoinAction.java	(revision 31417)
@@ -8,4 +8,5 @@
 import org.openstreetmap.josm.actions.JosmAction;
 import org.openstreetmap.josm.plugins.mapillary.MapillaryLayer;
+import org.openstreetmap.josm.plugins.mapillary.MapillaryPlugin;
 import org.openstreetmap.josm.plugins.mapillary.mode.JoinMode;
 import org.openstreetmap.josm.plugins.mapillary.mode.SelectMode;
@@ -27,5 +28,5 @@
    */
   public MapillaryJoinAction() {
-    super(tr("Join mode"), new ImageProvider("icon24.png"),
+    super(tr("Join mode"), new ImageProvider(MapillaryPlugin.directory + "images/icon24.png"),
         tr("Join/unjoin pictures"), Shortcut.registerShortcut("Mapillary join",
             tr("Join Mapillary pictures"), KeyEvent.CHAR_UNDEFINED,
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryWalkAction.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryWalkAction.java	(revision 31416)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryWalkAction.java	(revision 31417)
@@ -39,8 +39,8 @@
    */
   public MapillaryWalkAction() {
-    super(tr("Walk mode"), new ImageProvider("icon24.png"), tr("Walk mode"),
-        Shortcut.registerShortcut("Mapillary walk", tr("Start walk mode"),
-            KeyEvent.CHAR_UNDEFINED, Shortcut.NONE), false, "mapillaryWalk",
-        false);
+    super(tr("Walk mode"), new ImageProvider(MapillaryPlugin.directory
+        + "images/icon24.png"), tr("Walk mode"), Shortcut.registerShortcut(
+        "Mapillary walk", tr("Start walk mode"), KeyEvent.CHAR_UNDEFINED,
+        Shortcut.NONE), false, "mapillaryWalk", false);
     this.setEnabled(false);
   }
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryZoomAction.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryZoomAction.java	(revision 31416)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/actions/MapillaryZoomAction.java	(revision 31417)
@@ -30,5 +30,5 @@
    */
   public MapillaryZoomAction() {
-    super(tr("Zoom to selected image"), new ImageProvider("icon24.png"),
+    super(tr("Zoom to selected image"), new ImageProvider(MapillaryPlugin.directory + "images/icon24.png"),
         tr("Zoom to selected image"), Shortcut.registerShortcut(
             "Zoom Mapillary",
Index: /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySequenceDownloadThread.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySequenceDownloadThread.java	(revision 31416)
+++ /applications/editors/josm/plugins/mapillary/src/org/openstreetmap/josm/plugins/mapillary/downloads/MapillarySequenceDownloadThread.java	(revision 31417)
@@ -96,22 +96,25 @@
         LOCK.lock();
         MapillaryImage.LOCK.lock();
-        for (MapillaryImage img : finalImages) {
-          if (layer.getMapillaryData().getImages().contains(img)) {
-            // The image in finalImages is substituted by the one in the
-            // database, as they represent the same picture.
-            img = (MapillaryImage) layer.getMapillaryData().getImages()
-                .get(layer.getMapillaryData().getImages().indexOf(img));
-            sequence.add(img);
-            ((MapillaryImage) layer.getMapillaryData().getImages()
-                .get(layer.getMapillaryData().getImages().indexOf(img)))
-                .setSequence(sequence);
-            finalImages.set(finalImages.indexOf(img), img);
-          } else {
-            img.setSequence(sequence);
-            sequence.add(img);
+        try {
+          for (MapillaryImage img : finalImages) {
+            if (layer.getMapillaryData().getImages().contains(img)) {
+              // The image in finalImages is substituted by the one in the
+              // database, as they represent the same picture.
+              img = (MapillaryImage) layer.getMapillaryData().getImages()
+                  .get(layer.getMapillaryData().getImages().indexOf(img));
+              sequence.add(img);
+              ((MapillaryImage) layer.getMapillaryData().getImages()
+                  .get(layer.getMapillaryData().getImages().indexOf(img)))
+                  .setSequence(sequence);
+              finalImages.set(finalImages.indexOf(img), img);
+            } else {
+              img.setSequence(sequence);
+              sequence.add(img);
+            }
           }
+        } finally {
+          MapillaryImage.LOCK.unlock();
+          LOCK.unlock();
         }
-        MapillaryImage.LOCK.unlock();
-        LOCK.unlock();
 
         layer.getMapillaryData().addWithoutUpdate(
@@ -121,7 +124,4 @@
       Main.error("Error reading the url " + URL + queryString
           + " might be a Mapillary problem.");
-    } finally {
-      LOCK.unlock();
-      MapillaryImage.LOCK.unlock();
     }
   }
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 31417)
+++ /applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/AbstractTest.java	(revision 31417)
@@ -0,0 +1,30 @@
+package org.openstreetmap.josm.plugins.mapillary;
+
+import org.junit.BeforeClass;
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.gui.MainApplication;
+import org.openstreetmap.josm.plugins.mapillary.util.TestUtil;
+
+public abstract class AbstractTest {
+
+  private static boolean started = false;
+
+  @BeforeClass
+  public static void setUpBeforeClass() throws Exception {
+    if (!started) {
+      new Thread() {
+        @Override
+        public synchronized void run() {
+          MainApplication
+              .main(new String[] { "--download=http://www.openstreetmap.org/#map=18/40.42013/-3.68923" });
+        }
+      }.start();
+      started = true;
+      while (Main.map == null || Main.map.mapView == null) {
+        synchronized (Thread.currentThread()) {
+          Thread.currentThread().wait(1000);
+        }
+      }
+    }
+  }
+}
Index: /applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/AllTests.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/AllTests.java	(revision 31417)
+++ /applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/AllTests.java	(revision 31417)
@@ -0,0 +1,12 @@
+package org.openstreetmap.josm.plugins.mapillary;
+
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+import org.junit.runners.Suite.SuiteClasses;
+import org.openstreetmap.josm.plugins.mapillary.util.TestUtil;
+
+@RunWith(Suite.class)
+@SuiteClasses({ ImportTest.class,
+    MapillarySequenceDownloadThreadTest.class})
+public class AllTests {
+}
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 31417)
+++ /applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/ImportTest.java	(revision 31417)
@@ -0,0 +1,55 @@
+package org.openstreetmap.josm.plugins.mapillary;
+
+import static org.junit.Assert.*;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.imageio.IIOException;
+
+import org.apache.commons.imaging.common.RationalNumber;
+import org.apache.commons.imaging.formats.tiff.constants.GpsTagConstants;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import org.openstreetmap.gui.jmapviewer.interfaces.ICoordinate;
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.coor.LatLon;
+import org.openstreetmap.josm.gui.MainApplication;
+import org.openstreetmap.josm.plugins.mapillary.actions.MapillaryImportAction;
+
+public class ImportTest extends AbstractTest{
+
+  @Test
+  public void importNoTagsTest() throws InterruptedException {
+    File image = new File(MapillaryPlugin.directory + "images/icon16.png");
+    MapillaryImportedImage img = MapillaryPlugin.importAction.readNoTags(image);
+    assertEquals(0, img.getCa(), 0.01);
+    assert(Main.map.mapView.getRealBounds().getCenter().equalsEpsilon(img.getLatLon()));
+  }
+
+  @Test(expected=IIOException.class)
+  public void testInvalidFiles() throws IOException {
+      MapillaryImportedImage img = new MapillaryImportedImage(0,0,0, null);
+      assertEquals(null, img.getImage());
+      assertEquals(null, img.getFile());
+
+      img = new MapillaryImportedImage(0, 0, 0, new File(""));
+      assertEquals(new File(""), img.getFile());
+      img.getImage();
+  }
+
+  @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, MapillaryImportAction.degMinSecToDouble(num, ref), 0.01);
+    ref = GpsTagConstants.GPS_TAG_GPS_LATITUDE_REF_VALUE_SOUTH;
+    assertEquals(-1, MapillaryImportAction.degMinSecToDouble(num, ref), 0.01);
+    num[0] = new RationalNumber(180, 1);
+    assertEquals(0, MapillaryImportAction.degMinSecToDouble(num, ref), 0.01);
+  }
+
+}
Index: plications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/ImportedImageTest.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/ImportedImageTest.java	(revision 31416)
+++ 	(revision )
@@ -1,30 +1,0 @@
-package org.openstreetmap.josm.plugins.mapillary;
-
-import static org.junit.Assert.assertEquals;
-
-import java.io.File;
-import java.io.IOException;
-
-import javax.imageio.IIOException;
-
-import org.junit.Before;
-import org.junit.Test;
-
-public class ImportedImageTest {
-
-    @Before
-    public void setUp() {
-        MapillaryData.TEST_MODE = true;
-    }
-
-    @Test(expected=IIOException.class)
-    public void testInvalidFiles() throws IOException {
-        MapillaryImportedImage img = new MapillaryImportedImage(0,0,0, null);
-        assertEquals(null, img.getImage());
-        assertEquals(null, img.getFile());
-
-        img = new MapillaryImportedImage(0, 0, 0, new File(""));
-        assertEquals(new File(""), img.getFile());
-        img.getImage();
-    }
-}
Index: /applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/util/TestUtil.java
===================================================================
--- /applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/util/TestUtil.java	(revision 31416)
+++ /applications/editors/josm/plugins/mapillary/test/unit/org/openstreetmap/josm/plugins/mapillary/util/TestUtil.java	(revision 31417)
@@ -1,7 +1,12 @@
 package org.openstreetmap.josm.plugins.mapillary.util;
+
+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;
 
@@ -30,5 +35,10 @@
             I18n.set(Main.pref.get("language", "en"));
             Main.setProjection(Projections.getProjectionByCode("EPSG:3857")); // Mercator
-
+            try {
+              new MapillaryPlugin(new PluginInformation(new File("/home/nokutu/.josm/plugins/Mapillary.jar")));
+            } catch (PluginException e) {
+              // TODO Auto-generated catch block
+              e.printStackTrace();
+            }
             isInitialized = true;
         }
