source: josm/trunk/test/unit/org/openstreetmap/josm/gui/io/DownloadOpenChangesetsTaskTest.java@ 11110

Last change on this file since 11110 was 11110, checked in by Don-vip, 8 years ago

add more unit tests

  • Property svn:eol-style set to native
File size: 1.5 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.gui.io;
3
4import static org.junit.Assert.assertNotNull;
5import static org.junit.Assert.assertNull;
6import static org.junit.Assert.assertTrue;
7
8import javax.swing.JPanel;
9
10import org.junit.Rule;
11import org.junit.Test;
12import org.openstreetmap.josm.gui.JosmUserIdentityManager;
13import org.openstreetmap.josm.testutils.JOSMTestRules;
14
15import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
16
17/**
18 * Unit tests of {@link DownloadOpenChangesetsTask} class.
19 */
20public class DownloadOpenChangesetsTaskTest {
21
22 /**
23 * Setup tests
24 */
25 @Rule
26 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
27 public JOSMTestRules test = new JOSMTestRules().preferences().devAPI();
28
29 /**
30 * Test of {@link DownloadOpenChangesetsTask} class.
31 */
32 @Test
33 public void testDownloadOpenChangesetsTask() {
34 DownloadOpenChangesetsTask task = new DownloadOpenChangesetsTask(new JPanel());
35 assertNull(task.getChangesets());
36
37 assertTrue(JosmUserIdentityManager.getInstance().isAnonymous());
38 task.run();
39 assertNull(task.getChangesets());
40
41 task = new DownloadOpenChangesetsTask(new JPanel());
42 JosmUserIdentityManager.getInstance().setPartiallyIdentified(System.getProperty("osm.username", "josm_test"));
43 assertTrue(JosmUserIdentityManager.getInstance().isPartiallyIdentified());
44 task.run();
45 assertNotNull(task.getChangesets());
46 }
47}
Note: See TracBrowser for help on using the repository browser.