1 | // License: GPL. For details, see LICENSE file.
|
---|
2 | package org.openstreetmap.josm.gui.io;
|
---|
3 |
|
---|
4 | import static org.junit.Assert.assertFalse;
|
---|
5 | import static org.junit.Assert.assertNotNull;
|
---|
6 | import static org.junit.Assert.assertTrue;
|
---|
7 |
|
---|
8 | import java.util.Arrays;
|
---|
9 |
|
---|
10 | import org.junit.Rule;
|
---|
11 | import org.junit.Test;
|
---|
12 | import org.openstreetmap.josm.data.osm.DataSet;
|
---|
13 | import org.openstreetmap.josm.data.osm.OsmPrimitiveType;
|
---|
14 | import org.openstreetmap.josm.data.osm.SimplePrimitiveId;
|
---|
15 | import org.openstreetmap.josm.gui.layer.OsmDataLayer;
|
---|
16 | import org.openstreetmap.josm.testutils.JOSMTestRules;
|
---|
17 |
|
---|
18 | import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
---|
19 |
|
---|
20 | /**
|
---|
21 | * Unit tests of {@link DownloadPrimitivesTask} class.
|
---|
22 | */
|
---|
23 | public class DownloadPrimitivesTaskTest {
|
---|
24 |
|
---|
25 | /**
|
---|
26 | * Setup tests
|
---|
27 | */
|
---|
28 | @Rule
|
---|
29 | @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
|
---|
30 | public JOSMTestRules test = new JOSMTestRules().preferences().devAPI();
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * Test of {@link DownloadPrimitivesTask} class.
|
---|
34 | */
|
---|
35 | @Test
|
---|
36 | public void testDownloadPrimitivesTask() {
|
---|
37 | DataSet ds = new DataSet();
|
---|
38 | assertTrue(ds.allPrimitives().isEmpty());
|
---|
39 | SimplePrimitiveId pid = new SimplePrimitiveId(1, OsmPrimitiveType.NODE);
|
---|
40 | new DownloadPrimitivesTask(new OsmDataLayer(ds, "", null), Arrays.asList(pid), true).run();
|
---|
41 | assertFalse(ds.allPrimitives().isEmpty());
|
---|
42 | assertNotNull(ds.getPrimitiveById(pid));
|
---|
43 | }
|
---|
44 | }
|
---|