1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.io;
|
---|
3 |
|
---|
4 | import static org.junit.Assert.assertNotNull;
|
---|
5 | import static org.junit.Assert.assertNull;
|
---|
6 | import static org.junit.Assert.assertTrue;
|
---|
7 |
|
---|
8 | import javax.swing.JPanel;
|
---|
9 |
|
---|
10 | import org.junit.Rule;
|
---|
11 | import org.junit.Test;
|
---|
12 | import org.openstreetmap.josm.gui.JosmUserIdentityManager;
|
---|
13 | import org.openstreetmap.josm.testutils.JOSMTestRules;
|
---|
14 |
|
---|
15 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
---|
16 |
|
---|
17 | /**
|
---|
18 | * Unit tests of {@link DownloadOpenChangesetsTask} class.
|
---|
19 | */
|
---|
20 | public 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 | }
|
---|