source: josm/trunk/test/unit/org/openstreetmap/josm/actions/mapmode/AddNoteActionTest.java@ 17360

Last change on this file since 17360 was 17275, checked in by Don-vip, 3 years ago

see #16567 - upgrade almost all tests to JUnit 5, except those depending on WiremockRule

See https://github.com/tomakehurst/wiremock/issues/684

  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.actions.mapmode;
3
4import static org.junit.jupiter.api.Assertions.assertEquals;
5import static org.junit.jupiter.api.Assertions.assertTrue;
6
7import org.junit.jupiter.api.extension.RegisterExtension;
8import org.junit.jupiter.api.Test;
9import org.openstreetmap.josm.data.osm.DataSet;
10import org.openstreetmap.josm.data.osm.NoteData;
11import org.openstreetmap.josm.gui.MainApplication;
12import org.openstreetmap.josm.gui.MapFrame;
13import org.openstreetmap.josm.gui.layer.OsmDataLayer;
14import org.openstreetmap.josm.testutils.JOSMTestRules;
15
16import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
17
18/**
19 * Unit tests for class {@link AddNoteAction}.
20 */
21class AddNoteActionTest {
22
23 /**
24 * Setup test.
25 */
26 @RegisterExtension
27 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
28 public JOSMTestRules test = new JOSMTestRules().main().projection();
29
30 /**
31 * Unit test of {@link AddNoteAction#enterMode} and {@link AddNoteAction#exitMode}.
32 */
33 @Test
34 void testMode() {
35 OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
36 try {
37 MainApplication.getLayerManager().addLayer(layer);
38 AddNoteAction mapMode = new AddNoteAction(new NoteData());
39 MapFrame map = MainApplication.getMap();
40 MapMode oldMapMode = map.mapMode;
41 assertTrue(map.selectMapMode(mapMode));
42 assertEquals(mapMode, map.mapMode);
43 assertTrue(map.selectMapMode(oldMapMode));
44 } finally {
45 MainApplication.getLayerManager().removeLayer(layer);
46 }
47 }
48}
Note: See TracBrowser for help on using the repository browser.