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

Last change on this file since 18870 was 18870, checked in by taylor.smock, 17 months ago

See #16567: Update to JUnit 5

This converts most tests to use @Annotations. There are also some performance
improvements as it relates to tests.

  • 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.Test;
8import org.openstreetmap.josm.TestUtils;
9import org.openstreetmap.josm.actions.mapmode.ExtrudeAction.Mode;
10import org.openstreetmap.josm.data.osm.DataSet;
11import org.openstreetmap.josm.gui.MainApplication;
12import org.openstreetmap.josm.gui.MapFrame;
13import org.openstreetmap.josm.gui.layer.OsmDataLayer;
14import org.openstreetmap.josm.testutils.annotations.Main;
15import org.openstreetmap.josm.testutils.annotations.Projection;
16
17/**
18 * Unit tests for class {@link ExtrudeAction}.
19 */
20@Main
21@Projection
22class ExtrudeActionTest {
23 /**
24 * Unit test of {@link ExtrudeAction#enterMode} and {@link ExtrudeAction#exitMode}.
25 */
26 @Test
27 void testMode() {
28 OsmDataLayer layer = new OsmDataLayer(new DataSet(), "", null);
29 try {
30 MainApplication.getLayerManager().addLayer(layer);
31 ExtrudeAction mapMode = new ExtrudeAction();
32 MapFrame map = MainApplication.getMap();
33 MapMode oldMapMode = map.mapMode;
34 assertTrue(map.selectMapMode(mapMode));
35 assertEquals(mapMode, map.mapMode);
36 assertTrue(map.selectMapMode(oldMapMode));
37 } finally {
38 MainApplication.getLayerManager().removeLayer(layer);
39 }
40 }
41
42 /**
43 * Unit test of {@link Mode} enum.
44 */
45 @Test
46 void testEnumMode() {
47 TestUtils.superficialEnumCodeCoverage(Mode.class);
48 }
49}
Note: See TracBrowser for help on using the repository browser.