Changeset 13173 in josm for trunk/test


Ignore:
Timestamp:
2017-11-28T00:56:29+01:00 (6 years ago)
Author:
Don-vip
Message:

see #15310 - remove most of deprecated APIs

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

Legend:

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

    r13021 r13173  
    164164        if (Main.main == null) {
    165165            new MainApplication().initialize();
    166         } else {
    167             if (Main.main.panel == null) {
    168                 initMainPanel(false);
    169                 Main.main.panel = MainApplication.getMainPanel();
    170             }
    171             Main.main.panel.reAddListeners();
    172166        }
    173167        // Add a test layer to the layer manager to get the MapFrame
  • trunk/test/unit/org/openstreetmap/josm/MainTest.java

    r12639 r13173  
    55import static org.junit.Assert.assertFalse;
    66import static org.junit.Assert.assertNotNull;
    7 import static org.junit.Assert.assertNull;
    87import static org.junit.Assert.assertTrue;
    98
    109import java.net.MalformedURLException;
    1110import java.net.URL;
    12 import java.util.Collection;
    1311import java.util.Map;
    1412
     
    3331    @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
    3432    public JOSMTestRules test = new JOSMTestRules().platform().https().devAPI().main().projection();
    35 
    36     /**
    37      * Unit tests on log messages.
    38      * @deprecated to remove end of 2017
    39      */
    40     @Test
    41     @SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")
    42     @Deprecated
    43     public void testLogs() {
    44 
    45         assertNull(Main.getErrorMessage(null));
    46 
    47         // Correct behaviour with errors
    48         Main.error(new Exception("exception_error"));
    49         Main.error("Error message on one line");
    50         Main.error("Error message with {0}", "param");
    51         Main.error("First line of error message on several lines\nline2\nline3\nline4");
    52         Collection<String> errors = Main.getLastErrorAndWarnings();
    53         assertTrue(errors.contains("E: java.lang.Exception: exception_error"));
    54         assertTrue(errors.contains("E: Error message with param"));
    55         assertTrue(errors.contains("E: Error message on one line"));
    56         assertTrue(errors.contains("E: First line of error message on several lines"));
    57 
    58         // Correct behaviour with warnings
    59         Main.warn(new Exception("exception_warn", new Exception("root_cause")));
    60         Main.warn(new Exception("exception_warn_bool"), true);
    61         Main.warn("Warning message on one line");
    62         Main.warn("First line of warning message on several lines\nline2\nline3\nline4");
    63         Collection<String> warnings = Main.getLastErrorAndWarnings();
    64         assertTrue(warnings.contains("W: java.lang.Exception: exception_warn. Cause: java.lang.Exception: root_cause"));
    65         assertTrue(warnings.contains("W: java.lang.Exception: exception_warn_bool"));
    66         assertTrue(warnings.contains("W: Warning message on one line"));
    67         assertTrue(warnings.contains("W: First line of warning message on several lines"));
    68     }
    6933
    7034    /**
  • trunk/test/unit/org/openstreetmap/josm/data/oauth/OAuthParametersTest.java

    r13079 r13173  
    88import org.junit.Rule;
    99import org.junit.Test;
    10 import org.openstreetmap.josm.Main;
    1110import org.openstreetmap.josm.TestUtils;
    1211import org.openstreetmap.josm.io.OsmApi;
     
    4847
    4948    /**
    50      * Unit test of method {@link OAuthParameters#createFromPreferences}.
    51      * @deprecated to remove end of 2017
    52      */
    53     @Test
    54     @Deprecated
    55     public void testCreateFromPreferences() {
    56         assertNotNull(OAuthParameters.createFromPreferences(Main.pref));
    57     }
    58 
    59     /**
    6049     * Unit test of methods {@link OAuthParameters#equals} and {@link OAuthParameters#hashCode}.
    6150     */
  • trunk/test/unit/org/openstreetmap/josm/gui/MainApplicationTest.java

    r12899 r13173  
    8181     * @param reAddListeners {@code true} to re-add listeners
    8282     */
    83     @SuppressWarnings("deprecation")
    8483    public static void initMainPanel(boolean reAddListeners) {
    8584        if (MainApplication.mainPanel == null) {
     
    8988            MainApplication.mainPanel.reAddListeners();
    9089        }
    91         if (Main.main != null) {
    92             Main.main.panel = MainApplication.mainPanel;
    93         }
    9490    }
    9591
     
    9793     * Make sure {@code MainApplication.menu} is initialized.
    9894     */
    99     @SuppressWarnings("deprecation")
    10095    public static void initMainMenu() {
    10196        MainApplication.menu = new MainMenu();
    102         Main.main.menu = MainApplication.menu;
    10397    }
    10498
     
    106100     * Make sure {@link MainApplication#toolbar} is initialized.
    107101     */
    108     @SuppressWarnings("deprecation")
    109102    public static void initToolbar() {
    110103        if (MainApplication.toolbar == null) {
    111104            MainApplication.toolbar = new ToolbarPreferences();
    112         }
    113         if (Main.toolbar == null) {
    114             Main.toolbar = MainApplication.getToolbar();
    115105        }
    116106    }
Note: See TracChangeset for help on using the changeset viewer.