source: josm/trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ExtrudeActionTest.java@ 12632

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

see #15182 - fix unit tests

  • Property svn:eol-style set to native
File size: 1.8 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 org.junit.Rule;
8import org.junit.Test;
9import org.openstreetmap.josm.Main;
10import org.openstreetmap.josm.TestUtils;
11import org.openstreetmap.josm.actions.mapmode.ExtrudeAction.Mode;
12import org.openstreetmap.josm.data.osm.DataSet;
13import org.openstreetmap.josm.gui.MainApplication;
14import org.openstreetmap.josm.gui.MapFrame;
15import org.openstreetmap.josm.gui.layer.OsmDataLayer;
16import org.openstreetmap.josm.testutils.JOSMTestRules;
17
18import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
19
20/**
21 * Unit tests for class {@link ExtrudeAction}.
22 */
23public class ExtrudeActionTest {
24
25 /**
26 * Setup test.
27 */
28 @Rule
29 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
30 public JOSMTestRules test = new JOSMTestRules().platform().platform().main().projection();
31
32 /**
33 * Unit test of {@link ExtrudeAction#enterMode} and {@link ExtrudeAction#exitMode}.
34 */
35 @Test
36 public void testMode() {
37 OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
38 try {
39 Main.getLayerManager().addLayer(layer);
40 ExtrudeAction mapMode = new ExtrudeAction();
41 MapFrame map = MainApplication.getMap();
42 MapMode oldMapMode = map.mapMode;
43 assertTrue(map.selectMapMode(mapMode));
44 assertEquals(mapMode, map.mapMode);
45 assertTrue(map.selectMapMode(oldMapMode));
46 } finally {
47 Main.getLayerManager().removeLayer(layer);
48 }
49 }
50
51 /**
52 * Unit test of {@link Mode} enum.
53 */
54 @Test
55 public void testEnumMode() {
56 TestUtils.superficialEnumCodeCoverage(Mode.class);
57 }
58}
Note: See TracBrowser for help on using the repository browser.