Ignore:
Timestamp:
2017-08-03T19:57:36+02:00 (7 years ago)
Author:
Don-vip
Message:

speedup unit tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/actions/AlignInLineActionTest.java

    r12110 r12562  
    66
    77import org.junit.Before;
     8import org.junit.Rule;
    89import org.junit.Test;
    9 import org.openstreetmap.josm.JOSMFixture;
    1010import org.openstreetmap.josm.Main;
    1111import org.openstreetmap.josm.actions.AlignInLineAction.InvalidSelection;
     
    1717import org.openstreetmap.josm.data.osm.Way;
    1818import org.openstreetmap.josm.gui.layer.OsmDataLayer;
     19import org.openstreetmap.josm.testutils.JOSMTestRules;
     20
     21import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    1922
    2023/**
     
    2326public final class AlignInLineActionTest {
    2427
     28    /**
     29     * Setup test.
     30     */
     31    @Rule
     32    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     33    public JOSMTestRules test = new JOSMTestRules().mainMenu().projection();
     34
    2535    /** Class under test. */
    2636    private static AlignInLineAction action;
     
    3141    @Before
    3242    public void setUp() {
    33         JOSMFixture.createUnitTestFixture().init(true);
    34 
    3543        // Enable "Align in line" feature.
    3644        action = Main.main.menu.alignInLine;
     
    4351     * https://josm.openstreetmap.de/ticket/9605#comment:3. Note that in this test, after alignment, way is overlapping
    4452     * itself.
    45      */
    46     @Test
    47     public void testNodesOpenWay() {
     53     * @throws InvalidSelection never
     54     */
     55    @Test
     56    public void testNodesOpenWay() throws InvalidSelection {
    4857        DataSet dataSet = new DataSet();
    4958        OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null);
     
    6776            dataSet.addSelected(point1, point2, point3);
    6877
    69             action.actionPerformed(null);
     78            action.buildCommand().executeCommand();
    7079        } finally {
    7180            // Ensure we clean the place before leaving, even if test fails.
     
    8291     * Test case: only nodes selected, part of a closed way: align these nodes on the line passing through the most
    8392     * distant nodes.
    84      */
    85     @Test
    86     public void testNodesClosedWay() {
     93     * @throws InvalidSelection never
     94     */
     95    @Test
     96    public void testNodesClosedWay() throws InvalidSelection {
    8797        DataSet dataSet = new DataSet();
    8898        OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null);
     
    106116            dataSet.addSelected(point4, point1, point2);
    107117
    108             action.actionPerformed(null);
     118            action.buildCommand().executeCommand();
    109119        } finally {
    110120            // Ensure we clean the place before leaving, even if test fails.
     
    122132     * Test case: only nodes selected, part of multiple ways: align these nodes on the line passing through the most
    123133     * distant nodes.
    124      */
    125     @Test
    126     public void testNodesOpenWays() {
     134     * @throws InvalidSelection never
     135     */
     136    @Test
     137    public void testNodesOpenWays() throws InvalidSelection {
    127138        DataSet dataSet = new DataSet();
    128139        OsmDataLayer layer = new OsmDataLayer(dataSet, OsmDataLayer.createNewName(), null);
     
    149160
    150161            // Points must align between points 1 and 4.
    151             action.actionPerformed(null);
     162            action.buildCommand().executeCommand();
    152163        } finally {
    153164            // Ensure we clean the place before leaving, even if test fails.
Note: See TracChangeset for help on using the changeset viewer.