From d81eea4ec03d854e13f48e91a712045595c8ebdc Mon Sep 17 00:00:00 2001
From: Robert Scott <code@humanleg.org.uk>
Date: Sun, 26 Aug 2018 16:03:08 +0100
Subject: [PATCH v1 2/3] tests: AddNodeHandlerTest: add main, assertionsInEDT &
 projection to JOSMTestRules

we can also omit the attempt to clean up our added layer as that will be
handled by JOSMTestRules
---
 .../remotecontrol/handler/AddNodeHandlerTest.java   | 21 ++++++++-------------
 1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandlerTest.java b/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandlerTest.java
index 1db909812..2a80c5711 100644
--- a/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandlerTest.java
+++ b/test/unit/org/openstreetmap/josm/io/remotecontrol/handler/AddNodeHandlerTest.java
@@ -28,7 +28,7 @@ public class AddNodeHandlerTest {
      */
     @Rule
     @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
-    public JOSMTestRules test = new JOSMTestRules();
+    public JOSMTestRules test = new JOSMTestRules().main().assertionsInEDT().projection();
 
     private static AddNodeHandler newHandler(String url) throws RequestHandlerBadRequestException {
         AddNodeHandler req = new AddNodeHandler();
@@ -56,13 +56,11 @@ public class AddNodeHandlerTest {
     public void testBadRequestNoParam() throws Exception {
         thrown.expect(RequestHandlerBadRequestException.class);
         thrown.expectMessage("NumberFormatException (empty String)");
+
         OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
-        try {
-            MainApplication.getLayerManager().addLayer(layer);
-            newHandler(null).handle();
-        } finally {
-            MainApplication.getLayerManager().removeLayer(layer);
-        }
+        MainApplication.getLayerManager().addLayer(layer);
+
+        newHandler(null).handle();
     }
 
     /**
@@ -94,11 +92,8 @@ public class AddNodeHandlerTest {
     @Test
     public void testNominalRequest() throws Exception {
         OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
-        try {
-            MainApplication.getLayerManager().addLayer(layer);
-            newHandler("https://localhost?lat=0&lon=0").handle();
-        } finally {
-            MainApplication.getLayerManager().removeLayer(layer);
-        }
+        MainApplication.getLayerManager().addLayer(layer);
+
+        newHandler("https://localhost?lat=0&lon=0").handle();
     }
 }
-- 
2.11.0

