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
|
b
|
public class AddNodeHandlerTest {
|
| 28 | 28 | */ |
| 29 | 29 | @Rule |
| 30 | 30 | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") |
| 31 | | public JOSMTestRules test = new JOSMTestRules(); |
| | 31 | public JOSMTestRules test = new JOSMTestRules().main().assertionsInEDT().projection(); |
| 32 | 32 | |
| 33 | 33 | private static AddNodeHandler newHandler(String url) throws RequestHandlerBadRequestException { |
| 34 | 34 | AddNodeHandler req = new AddNodeHandler(); |
| … |
… |
public class AddNodeHandlerTest {
|
| 56 | 56 | public void testBadRequestNoParam() throws Exception { |
| 57 | 57 | thrown.expect(RequestHandlerBadRequestException.class); |
| 58 | 58 | thrown.expectMessage("NumberFormatException (empty String)"); |
| | 59 | |
| 59 | 60 | OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null); |
| 60 | | try { |
| 61 | | MainApplication.getLayerManager().addLayer(layer); |
| 62 | | newHandler(null).handle(); |
| 63 | | } finally { |
| 64 | | MainApplication.getLayerManager().removeLayer(layer); |
| 65 | | } |
| | 61 | MainApplication.getLayerManager().addLayer(layer); |
| | 62 | |
| | 63 | newHandler(null).handle(); |
| 66 | 64 | } |
| 67 | 65 | |
| 68 | 66 | /** |
| … |
… |
public class AddNodeHandlerTest {
|
| 94 | 92 | @Test |
| 95 | 93 | public void testNominalRequest() throws Exception { |
| 96 | 94 | OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null); |
| 97 | | try { |
| 98 | | MainApplication.getLayerManager().addLayer(layer); |
| 99 | | newHandler("https://localhost?lat=0&lon=0").handle(); |
| 100 | | } finally { |
| 101 | | MainApplication.getLayerManager().removeLayer(layer); |
| 102 | | } |
| | 95 | MainApplication.getLayerManager().addLayer(layer); |
| | 96 | |
| | 97 | newHandler("https://localhost?lat=0&lon=0").handle(); |
| 103 | 98 | } |
| 104 | 99 | } |