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

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

fix unit tests

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