Changeset 14977 in josm for trunk/test/unit/org/openstreetmap/josm/gui
- Timestamp:
- 2019-04-09T01:32:56+02:00 (5 years ago)
- Location:
- trunk/test/unit/org/openstreetmap/josm/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/gui/TableCellRendererTest.java
r14138 r14977 20 20 import org.openstreetmap.josm.testutils.JOSMTestRules; 21 21 import org.openstreetmap.josm.tools.Logging; 22 import org.openstreetmap.josm.tools. Utils;22 import org.openstreetmap.josm.tools.ReflectionUtils; 23 23 24 24 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; … … 99 99 c = klass.getDeclaredConstructor(); 100 100 } 101 Utils.setObjectsAccessible(c);101 ReflectionUtils.setObjectsAccessible(c); 102 102 if (needOuterClass) { 103 103 return c.newInstance(createInstance(klass.getDeclaringClass())); -
trunk/test/unit/org/openstreetmap/josm/gui/io/UploadDialogTest.java
r14355 r14977 4 4 import static org.junit.Assert.assertEquals; 5 5 import static org.junit.Assert.assertFalse; 6 import static org.junit.Assert.assertNull; 6 7 import static org.junit.Assert.assertTrue; 7 8 8 9 import java.awt.GraphicsEnvironment; 10 import java.util.Arrays; 9 11 import java.util.List; 10 12 import java.util.Map; 11 13 import java.util.concurrent.ConcurrentHashMap; 14 import java.util.function.Supplier; 15 12 16 import javax.swing.JButton; 13 17 import javax.swing.JOptionPane; … … 15 19 import org.junit.Rule; 16 20 import org.junit.Test; 21 import org.openstreetmap.josm.TestUtils; 17 22 import org.openstreetmap.josm.gui.ExtendedDialog; 18 import org.openstreetmap.josm.TestUtils;19 23 import org.openstreetmap.josm.io.UploadStrategySpecification; 24 import org.openstreetmap.josm.spi.preferences.Config; 20 25 import org.openstreetmap.josm.testutils.JOSMTestRules; 21 26 import org.openstreetmap.josm.testutils.mockers.ExtendedDialogMocker; 22 27 import org.openstreetmap.josm.testutils.mockers.WindowMocker; 23 28 29 import com.google.common.collect.ImmutableMap; 30 31 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; 24 32 import mockit.Invocation; 25 33 import mockit.Mock; 26 27 import com.google.common.collect.ImmutableMap;28 29 import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;30 34 31 35 /** … … 96 100 public Map<String, String> getTags(boolean keepEmpty) { 97 101 return new ConcurrentHashMap<>(); 102 } 103 104 @Override 105 public void forceUpdateActiveField() { 106 // Do nothing 98 107 } 99 108 } … … 214 223 assertTrue(UploadDialog.UploadAction.isUploadCommentTooShort("\u0860")); 215 224 } 225 226 private static void doTestGetLastChangesetTagFromHistory(String historyKey, Supplier<String> methodToTest, String def) { 227 Config.getPref().putList(historyKey, null); 228 Config.getPref().putInt(BasicUploadSettingsPanel.HISTORY_LAST_USED_KEY, 0); 229 Config.getPref().putInt(BasicUploadSettingsPanel.HISTORY_MAX_AGE_KEY, 30); 230 assertNull(methodToTest.get()); // age NOK (history empty) 231 Config.getPref().putList(historyKey, Arrays.asList("foo")); 232 assertNull(methodToTest.get()); // age NOK (history not empty) 233 Config.getPref().putLong(BasicUploadSettingsPanel.HISTORY_LAST_USED_KEY, System.currentTimeMillis() / 1000); 234 assertEquals("foo", methodToTest.get()); // age OK, history not empty 235 Config.getPref().putList(historyKey, null); 236 assertEquals(def, methodToTest.get()); // age OK, history empty 237 } 238 239 /** 240 * Test of {@link UploadDialog#getLastChangesetCommentFromHistory} method. 241 */ 242 @Test 243 public void testGetLastChangesetCommentFromHistory() { 244 doTestGetLastChangesetTagFromHistory( 245 BasicUploadSettingsPanel.HISTORY_KEY, 246 UploadDialog::getLastChangesetCommentFromHistory, 247 null); 248 } 249 250 /** 251 * Test of {@link UploadDialog#getLastChangesetSourceFromHistory} method. 252 */ 253 @Test 254 public void testGetLastChangesetSourceFromHistory() { 255 doTestGetLastChangesetTagFromHistory( 256 BasicUploadSettingsPanel.SOURCE_HISTORY_KEY, 257 UploadDialog::getLastChangesetSourceFromHistory, 258 BasicUploadSettingsPanel.getDefaultSources().get(0)); 259 } 216 260 }
Note:
See TracChangeset
for help on using the changeset viewer.