source: josm/trunk/test/unit/org/openstreetmap/josm/actions/mapmode/ParallelWayActionTest.java@ 11978

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

improve coverage and javadoc of enum classes for package actions

  • Property svn:eol-style set to native
File size: 1.9 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.ParallelWayAction.Mode;
12import org.openstreetmap.josm.actions.mapmode.ParallelWayAction.Modifier;
13import org.openstreetmap.josm.data.osm.DataSet;
14import org.openstreetmap.josm.gui.layer.OsmDataLayer;
15import org.openstreetmap.josm.testutils.JOSMTestRules;
16
17import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
18
19/**
20 * Unit tests for class {@link ParallelWayAction}.
21 */
22public class ParallelWayActionTest {
23
24 /**
25 * Setup test.
26 */
27 @Rule
28 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
29 public JOSMTestRules test = new JOSMTestRules().platform().commands();
30
31 /**
32 * Unit test of {@link ParallelWayAction#enterMode} and {@link ParallelWayAction#exitMode}.
33 */
34 @Test
35 public void testMode() {
36 OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
37 try {
38 Main.getLayerManager().addLayer(layer);
39 ParallelWayAction mapMode = new ParallelWayAction(Main.map);
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.getLayerManager().removeLayer(layer);
46 }
47 }
48
49 /**
50 * Unit test of {@link Mode} enum.
51 */
52 @Test
53 public void testEnumMode() {
54 TestUtils.superficialEnumCodeCoverage(Mode.class);
55 }
56
57 /**
58 * Unit test of {@link Modifier} enum.
59 */
60 @Test
61 public void testEnumModifier() {
62 TestUtils.superficialEnumCodeCoverage(Modifier.class);
63 }
64}
Note: See TracBrowser for help on using the repository browser.