Changeset 10553 in josm for trunk/test


Ignore:
Timestamp:
2016-07-17T14:54:06+02:00 (8 years ago)
Author:
Don-vip
Message:

fix #13079 - Use JOSMTestRules instead of JOSMFixture (tools tests, patch by michael2402) - gsoc-core

Location:
trunk/test/unit/org/openstreetmap/josm
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/testutils/JOSMTestRules.java

    r10475 r10553  
    161161     */
    162162    protected void before() throws InitializationError {
    163         cleanUpFromJosmFixture();
    164 
    165163        // Tests are running headless by default.
    166164        System.setProperty("java.awt.headless", "true");
     165
     166        cleanUpFromJosmFixture();
     167
    167168        // All tests use the same timezone.
    168169        TimeZone.setDefault(DateUtils.UTC);
  • trunk/test/unit/org/openstreetmap/josm/tools/GeometryTest.java

    r9952 r10553  
    66
    77import org.junit.Assert;
    8 import org.junit.BeforeClass;
     8import org.junit.Rule;
    99import org.junit.Test;
    10 import org.openstreetmap.josm.JOSMFixture;
    1110import org.openstreetmap.josm.TestUtils;
    1211import org.openstreetmap.josm.actions.search.SearchCompiler;
     
    1615import org.openstreetmap.josm.data.osm.Way;
    1716import org.openstreetmap.josm.io.OsmReader;
     17import org.openstreetmap.josm.testutils.JOSMTestRules;
     18
     19import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    1820
    1921/**
     
    2123 */
    2224public class GeometryTest {
    23 
    2425    /**
    25      * Setup test.
     26     * Primitives need preferences and projection.
    2627     */
    27     @BeforeClass
    28     public static void setUp() {
    29         JOSMFixture.createUnitTestFixture().init();
    30     }
     28    @Rule
     29    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     30    public JOSMTestRules test = new JOSMTestRules().preferences().projection();
    3131
    3232    /**
  • trunk/test/unit/org/openstreetmap/josm/tools/OverpassTurboQueryWizardTest.java

    r9856 r10553  
    44import static org.junit.Assert.assertEquals;
    55
    6 import org.junit.BeforeClass;
     6import org.junit.Rule;
    77import org.junit.Test;
    8 import org.openstreetmap.josm.JOSMFixture;
     8import org.openstreetmap.josm.testutils.JOSMTestRules;
     9
     10import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    911
    1012/**
     
    1214 */
    1315public class OverpassTurboQueryWizardTest {
    14 
    1516    /**
    16      * Setup test.
     17     * Base test environment is enough
    1718     */
    18     @BeforeClass
    19     public static void setUp() {
    20         JOSMFixture.createUnitTestFixture().init(false);
    21         OverpassTurboQueryWizard.getInstance();
    22     }
     19    @Rule
     20    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     21    public JOSMTestRules test = new JOSMTestRules();
    2322
    2423    /**
  • trunk/test/unit/org/openstreetmap/josm/tools/PredicatesTest.java

    r10399 r10553  
    1111import java.util.regex.Pattern;
    1212
    13 import org.junit.BeforeClass;
     13import org.junit.Rule;
    1414import org.junit.Test;
    15 import org.openstreetmap.josm.JOSMFixture;
    1615import org.openstreetmap.josm.data.osm.Node;
    1716import org.openstreetmap.josm.data.osm.OsmPrimitive;
     17import org.openstreetmap.josm.testutils.JOSMTestRules;
     18
     19import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    1820
    1921/**
     
    2426public class PredicatesTest {
    2527    /**
    26      * Not needed by this test, but JOSM has so many dependencies :-(
    27      */
    28     @BeforeClass
    29     public static void setUpClass() {
    30         JOSMFixture.createUnitTestFixture().init();
    31     }
     28     * Some of this depends on preferences.
     29     */
     30    @Rule
     31    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     32    public JOSMTestRules test = new JOSMTestRules().preferences();
    3233
    3334    /**
  • trunk/test/unit/org/openstreetmap/josm/tools/TextTagParserTest.java

    r10378 r10553  
    77
    88import org.junit.Assert;
    9 import org.junit.BeforeClass;
     9import org.junit.Rule;
    1010import org.junit.Test;
    11 import org.openstreetmap.josm.JOSMFixture;
     11import org.openstreetmap.josm.testutils.JOSMTestRules;
     12
     13import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    1214
    1315/**
     
    1517 */
    1618public class TextTagParserTest {
    17 
    1819    /**
    19      * Setup test.
     20     * Some of this depends on preferences.
    2021     */
    21     @BeforeClass
    22     public static void setUp() {
    23         JOSMFixture.createUnitTestFixture().init();
    24     }
     22    @Rule
     23    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     24    public JOSMTestRules test = new JOSMTestRules().preferences();
    2525
    2626    /**
  • trunk/test/unit/org/openstreetmap/josm/tools/WindowGeometryTest.java

    r10200 r10553  
    1414import javax.swing.JPanel;
    1515
    16 import org.junit.BeforeClass;
     16import org.junit.Rule;
    1717import org.junit.Test;
    18 import org.openstreetmap.josm.JOSMFixture;
    1918import org.openstreetmap.josm.Main;
     19import org.openstreetmap.josm.testutils.JOSMTestRules;
    2020import org.openstreetmap.josm.tools.WindowGeometry.WindowGeometryException;
    2121
     22import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    2223import nl.jqno.equalsverifier.EqualsVerifier;
    2324import nl.jqno.equalsverifier.Warning;
     
    2728 */
    2829public class WindowGeometryTest {
    29 
    3030    /**
    31      * Setup test.
     31     * Some of this depends on preferences.
    3232     */
    33     @BeforeClass
    34     public static void setUp() {
    35         JOSMFixture.createUnitTestFixture().init();
    36     }
     33    @Rule
     34    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
     35    public JOSMTestRules test = new JOSMTestRules().preferences();
    3736
    3837    /**
     
    5352        assertEquals(new WindowGeometry(new Point(0, 0), dim), WindowGeometry.centerOnScreen(dim));
    5453        assertEquals(new WindowGeometry(new Point(300, 250), dim), WindowGeometry.centerOnScreen(dim, null));
     54
     55        Main.pref.put("gui.geometry", "x=0,y=0,width=800,height=600");
     56        assertEquals(new WindowGeometry(new Point(300, 250), dim), WindowGeometry.centerOnScreen(dim));
    5557    }
    5658
Note: See TracChangeset for help on using the changeset viewer.