Index: trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandlerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandlerTest.java	(revision 10116)
+++ trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddWayHandlerTest.java	(revision 10116)
@@ -0,0 +1,104 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.io.remotecontrol.handler;
+
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.openstreetmap.josm.JOSMFixture;
+import org.openstreetmap.josm.Main;
+import org.openstreetmap.josm.data.osm.DataSet;
+import org.openstreetmap.josm.gui.layer.OsmDataLayer;
+import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
+
+/**
+ * Unit tests of {@link AddWayHandler} class.
+ */
+public class AddWayHandlerTest {
+
+    /**
+     * Rule used for tests throwing exceptions.
+     */
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    /**
+     * Setup test.
+     */
+    @BeforeClass
+    public static void setUpBeforeClass() {
+        JOSMFixture.createUnitTestFixture().init(true);
+    }
+
+    private static AddWayHandler newHandler(String url) {
+        AddWayHandler req = new AddWayHandler();
+        if (url != null)
+            req.setUrl(url);
+        return req;
+    }
+
+    /**
+     * Unit test for bad request - no layer.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestNoLayer() throws Exception {
+        thrown.expect(RequestHandlerBadRequestException.class);
+        thrown.expectMessage("There is no layer opened to add way");
+        newHandler("https://localhost?way=0,0;1,1").handle();
+    }
+
+    /**
+     * Unit test for bad request - no param.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestNoParam() throws Exception {
+        thrown.expect(RequestHandlerBadRequestException.class);
+        thrown.expectMessage("Invalid coordinates: []");
+        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
+        try {
+            Main.main.addLayer(layer);
+            newHandler(null).handle();
+        } finally {
+            Main.main.removeLayer(layer);
+        }
+    }
+
+    /**
+     * Unit test for bad request - invalid URL.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestInvalidUrl() throws Exception {
+        thrown.expect(RequestHandlerBadRequestException.class);
+        thrown.expectMessage("The following keys are mandatory, but have not been provided: way");
+        newHandler("invalid_url").handle();
+    }
+
+    /**
+     * Unit test for bad request - incomplete URL.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestIncompleteUrl() throws Exception {
+        thrown.expect(RequestHandlerBadRequestException.class);
+        thrown.expectMessage("The following keys are mandatory, but have not been provided: way");
+        newHandler("https://localhost").handle();
+    }
+
+    /**
+     * Unit test for nominal request - local data file.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testNominalRequest() throws Exception {
+        OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
+        try {
+            Main.main.addLayer(layer);
+            newHandler("https://localhost?way=0,0;1,1").handle();
+        } finally {
+            Main.main.removeLayer(layer);
+        }
+    }
+}
Index: trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandlerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandlerTest.java	(revision 10116)
+++ trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/ImageryHandlerTest.java	(revision 10116)
@@ -0,0 +1,78 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.io.remotecontrol.handler;
+
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.openstreetmap.josm.JOSMFixture;
+import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
+
+/**
+ * Unit tests of {@link ImageryHandler} class.
+ */
+public class ImageryHandlerTest {
+
+    /**
+     * Rule used for tests throwing exceptions.
+     */
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    /**
+     * Setup test.
+     */
+    @BeforeClass
+    public static void setUpBeforeClass() {
+        JOSMFixture.createUnitTestFixture().init(true);
+    }
+
+    private static ImageryHandler newHandler(String url) {
+        ImageryHandler req = new ImageryHandler();
+        if (url != null)
+            req.setUrl(url);
+        return req;
+    }
+
+    /**
+     * Unit test for bad request - no param.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestNoParam() throws Exception {
+        thrown.expect(RequestHandlerBadRequestException.class);
+        thrown.expectMessage("Parameter must not be null");
+        newHandler(null).handle();
+    }
+
+    /**
+     * Unit test for bad request - invalid URL.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestInvalidUrl() throws Exception {
+        thrown.expect(RequestHandlerBadRequestException.class);
+        thrown.expectMessage("The following keys are mandatory, but have not been provided: url");
+        newHandler("invalid_url").handle();
+    }
+
+    /**
+     * Unit test for bad request - incomplete URL.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestIncompleteUrl() throws Exception {
+        thrown.expect(RequestHandlerBadRequestException.class);
+        thrown.expectMessage("The following keys are mandatory, but have not been provided: url");
+        newHandler("https://localhost").handle();
+    }
+
+    /**
+     * Unit test for nominal request - local data file.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testNominalRequest() throws Exception {
+        newHandler("https://localhost?url=foo").handle();
+    }
+}
Index: trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandlerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandlerTest.java	(revision 10116)
+++ trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadAndZoomHandlerTest.java	(revision 10116)
@@ -0,0 +1,78 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.io.remotecontrol.handler;
+
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.openstreetmap.josm.JOSMFixture;
+import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
+
+/**
+ * Unit tests of {@link LoadAndZoomHandler} class.
+ */
+public class LoadAndZoomHandlerTest {
+
+    /**
+     * Rule used for tests throwing exceptions.
+     */
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    /**
+     * Setup test.
+     */
+    @BeforeClass
+    public static void setUpBeforeClass() {
+        JOSMFixture.createUnitTestFixture().init(true);
+    }
+
+    private static LoadAndZoomHandler newHandler(String url) {
+        LoadAndZoomHandler req = new LoadAndZoomHandler();
+        if (url != null)
+            req.setUrl(url);
+        return req;
+    }
+
+    /**
+     * Unit test for bad request - no param.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestNoParam() throws Exception {
+        thrown.expect(RequestHandlerBadRequestException.class);
+        thrown.expectMessage("NumberFormatException (empty String)");
+        newHandler(null).handle();
+    }
+
+    /**
+     * Unit test for bad request - invalid URL.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestInvalidUrl() throws Exception {
+        thrown.expect(RequestHandlerBadRequestException.class);
+        thrown.expectMessage("The following keys are mandatory, but have not been provided: bottom, top, left, right");
+        newHandler("invalid_url").handle();
+    }
+
+    /**
+     * Unit test for bad request - incomplete URL.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestIncompleteUrl() throws Exception {
+        thrown.expect(RequestHandlerBadRequestException.class);
+        thrown.expectMessage("The following keys are mandatory, but have not been provided: bottom, top, left, right");
+        newHandler("https://localhost").handle();
+    }
+
+    /**
+     * Unit test for nominal request - local data file.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testNominalRequest() throws Exception {
+        newHandler("https://localhost?bottom=0&top=0&left=1&right=1").handle();
+    }
+}
Index: trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandlerTest.java
===================================================================
--- trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandlerTest.java	(revision 10116)
+++ trunk/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/LoadObjectHandlerTest.java	(revision 10116)
@@ -0,0 +1,76 @@
+// License: GPL. For details, see LICENSE file.
+package org.openstreetmap.josm.io.remotecontrol.handler;
+
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.ExpectedException;
+import org.openstreetmap.josm.JOSMFixture;
+import org.openstreetmap.josm.io.remotecontrol.handler.RequestHandler.RequestHandlerBadRequestException;
+
+/**
+ * Unit tests of {@link LoadObjectHandler} class.
+ */
+public class LoadObjectHandlerTest {
+
+    /**
+     * Rule used for tests throwing exceptions.
+     */
+    @Rule
+    public ExpectedException thrown = ExpectedException.none();
+
+    /**
+     * Setup test.
+     */
+    @BeforeClass
+    public static void setUpBeforeClass() {
+        JOSMFixture.createUnitTestFixture().init(true);
+    }
+
+    private static LoadObjectHandler newHandler(String url) {
+        LoadObjectHandler req = new LoadObjectHandler();
+        if (url != null)
+            req.setUrl(url);
+        return req;
+    }
+
+    /**
+     * Unit test for bad request - no param.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestNoParam() throws Exception {
+        newHandler(null).handle();
+    }
+
+    /**
+     * Unit test for bad request - invalid URL.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestInvalidUrl() throws Exception {
+        thrown.expect(RequestHandlerBadRequestException.class);
+        thrown.expectMessage("The following keys are mandatory, but have not been provided: objects");
+        newHandler("invalid_url").handle();
+    }
+
+    /**
+     * Unit test for bad request - incomplete URL.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testBadRequestIncompleteUrl() throws Exception {
+        thrown.expect(RequestHandlerBadRequestException.class);
+        thrown.expectMessage("The following keys are mandatory, but have not been provided: objects");
+        newHandler("https://localhost").handle();
+    }
+
+    /**
+     * Unit test for nominal request - local data file.
+     * @throws Exception if any error occurs
+     */
+    @Test
+    public void testNominalRequest() throws Exception {
+        newHandler("https://localhost?objects=foo,bar").handle();
+    }
+}
