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

Last change on this file since 9944 was 9944, checked in by Don-vip, 8 years ago

mapmode: add basic unit tests

  • Property svn:eol-style set to native
File size: 1.4 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.actions.mapmode;
3
4import static org.junit.Assert.assertEquals;
5import static org.junit.Assert.assertTrue;
6
7import java.util.Collections;
8
9import org.junit.BeforeClass;
10import org.junit.Test;
11import org.openstreetmap.josm.JOSMFixture;
12import org.openstreetmap.josm.Main;
13import org.openstreetmap.josm.data.notes.Note;
14import org.openstreetmap.josm.data.osm.DataSet;
15import org.openstreetmap.josm.data.osm.NoteData;
16import org.openstreetmap.josm.gui.layer.OsmDataLayer;
17
18/**
19 * Unit tests for class {@link AddNoteAction}.
20 */
21public class AddNoteActionTest {
22
23 /**
24 * Setup test.
25 */
26 @BeforeClass
27 public static void setUp() {
28 JOSMFixture.createUnitTestFixture().init(true);
29 }
30
31 /**
32 * Unit test of {@link AddNoteAction#enterMode} and {@link AddNoteAction#exitMode}.
33 */
34 @Test
35 public void testMode() {
36 OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
37 try {
38 Main.main.addLayer(layer);
39 AddNoteAction mapMode = new AddNoteAction(Main.map, new NoteData(Collections.<Note>emptyList()));
40 MapMode oldMapMode = Main.map.mapMode;
41 assertTrue(Main.map.selectMapMode(mapMode));
42 assertEquals(mapMode, Main.map.mapMode);
43 assertTrue(Main.map.selectMapMode(oldMapMode));
44 } finally {
45 Main.main.removeLayer(layer);
46 }
47 }
48}
Note: See TracBrowser for help on using the repository browser.