source: josm/trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskListTest.java@ 17360

Last change on this file since 17360 was 17275, checked in by Don-vip, 3 years ago

see #16567 - upgrade almost all tests to JUnit 5, except those depending on WiremockRule

See https://github.com/tomakehurst/wiremock/issues/684

  • Property svn:eol-style set to native
File size: 1.9 KB
Line 
1// License: GPL. For details, see LICENSE file.
2package org.openstreetmap.josm.actions.downloadtasks;
3
4import static org.junit.jupiter.api.Assertions.assertTrue;
5import static org.junit.jupiter.api.Assertions.assertNull;
6
7import java.awt.geom.Area;
8import java.util.Collections;
9
10import org.junit.jupiter.api.Test;
11import org.junit.jupiter.api.extension.RegisterExtension;
12import org.openstreetmap.josm.data.Bounds;
13import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
14import org.openstreetmap.josm.testutils.JOSMTestRules;
15
16import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
17
18/**
19 * Unit tests for class {@link DownloadTaskList}.
20 */
21class DownloadTaskListTest {
22
23 /**
24 * Setup test.
25 */
26 @RegisterExtension
27 @SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD")
28 public JOSMTestRules test = new JOSMTestRules();
29
30 /**
31 * Unit test of {@code DownloadTaskList#DownloadTaskList}.
32 */
33 @Test
34 void testDownloadTaskList() {
35 assertTrue(new DownloadTaskList().getDownloadedPrimitives().isEmpty());
36 }
37
38 /**
39 * Unit test of {@code DownloadTaskList#download} - empty cases.
40 * @throws Exception in case of error
41 */
42 @Test
43 void testDownloadAreaEmpty() throws Exception {
44 DownloadTaskList list = new DownloadTaskList();
45 assertNull(list.download(false,
46 Collections.<Area>emptyList(), true, true, NullProgressMonitor.INSTANCE).get());
47 assertTrue(list.getDownloadedPrimitives().isEmpty());
48 assertNull(list.download(false,
49 Collections.<Area>emptyList(), false, false, NullProgressMonitor.INSTANCE).get());
50 assertTrue(list.getDownloadedPrimitives().isEmpty());
51 assertNull(list.download(false,
52 Collections.<Area>singletonList(new Area(new Bounds(0, 0, true).asRect())), false, false, NullProgressMonitor.INSTANCE).get());
53 assertTrue(list.getDownloadedPrimitives().isEmpty());
54 }
55}
Note: See TracBrowser for help on using the repository browser.