Changeset 13173 in josm for trunk/test/unit/org
- Timestamp:
- 2017-11-28T00:56:29+01:00 (7 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/JOSMFixture.java
r13021 r13173 164 164 if (Main.main == null) { 165 165 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();172 166 } 173 167 // Add a test layer to the layer manager to get the MapFrame -
trunk/test/unit/org/openstreetmap/josm/MainTest.java
r12639 r13173 5 5 import static org.junit.Assert.assertFalse; 6 6 import static org.junit.Assert.assertNotNull; 7 import static org.junit.Assert.assertNull;8 7 import static org.junit.Assert.assertTrue; 9 8 10 9 import java.net.MalformedURLException; 11 10 import java.net.URL; 12 import java.util.Collection;13 11 import java.util.Map; 14 12 … … 33 31 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD") 34 32 public JOSMTestRules test = new JOSMTestRules().platform().https().devAPI().main().projection(); 35 36 /**37 * Unit tests on log messages.38 * @deprecated to remove end of 201739 */40 @Test41 @SuppressFBWarnings(value = "ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD")42 @Deprecated43 public void testLogs() {44 45 assertNull(Main.getErrorMessage(null));46 47 // Correct behaviour with errors48 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 warnings59 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 }69 33 70 34 /** -
trunk/test/unit/org/openstreetmap/josm/data/oauth/OAuthParametersTest.java
r13079 r13173 8 8 import org.junit.Rule; 9 9 import org.junit.Test; 10 import org.openstreetmap.josm.Main;11 10 import org.openstreetmap.josm.TestUtils; 12 11 import org.openstreetmap.josm.io.OsmApi; … … 48 47 49 48 /** 50 * Unit test of method {@link OAuthParameters#createFromPreferences}.51 * @deprecated to remove end of 201752 */53 @Test54 @Deprecated55 public void testCreateFromPreferences() {56 assertNotNull(OAuthParameters.createFromPreferences(Main.pref));57 }58 59 /**60 49 * Unit test of methods {@link OAuthParameters#equals} and {@link OAuthParameters#hashCode}. 61 50 */ -
trunk/test/unit/org/openstreetmap/josm/gui/MainApplicationTest.java
r12899 r13173 81 81 * @param reAddListeners {@code true} to re-add listeners 82 82 */ 83 @SuppressWarnings("deprecation")84 83 public static void initMainPanel(boolean reAddListeners) { 85 84 if (MainApplication.mainPanel == null) { … … 89 88 MainApplication.mainPanel.reAddListeners(); 90 89 } 91 if (Main.main != null) {92 Main.main.panel = MainApplication.mainPanel;93 }94 90 } 95 91 … … 97 93 * Make sure {@code MainApplication.menu} is initialized. 98 94 */ 99 @SuppressWarnings("deprecation")100 95 public static void initMainMenu() { 101 96 MainApplication.menu = new MainMenu(); 102 Main.main.menu = MainApplication.menu;103 97 } 104 98 … … 106 100 * Make sure {@link MainApplication#toolbar} is initialized. 107 101 */ 108 @SuppressWarnings("deprecation")109 102 public static void initToolbar() { 110 103 if (MainApplication.toolbar == null) { 111 104 MainApplication.toolbar = new ToolbarPreferences(); 112 }113 if (Main.toolbar == null) {114 Main.toolbar = MainApplication.getToolbar();115 105 } 116 106 }
Note:
See TracChangeset
for help on using the changeset viewer.