Changeset 15216 in josm for trunk/test


Ignore:
Timestamp:
2019-07-06T23:39:16+02:00 (5 years ago)
Author:
Don-vip
Message:

see #17871 - add basic unit test

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskListTest.java

    r10945 r15216  
    22package org.openstreetmap.josm.actions.downloadtasks;
    33
     4import static org.junit.Assert.assertNull;
    45import static org.junit.Assert.assertTrue;
     6
     7import java.awt.geom.Area;
     8import java.util.Collections;
    59
    610import org.junit.Rule;
    711import org.junit.Test;
     12import org.openstreetmap.josm.data.Bounds;
     13import org.openstreetmap.josm.gui.progress.NullProgressMonitor;
    814import org.openstreetmap.josm.testutils.JOSMTestRules;
    915
     
    2935        assertTrue(new DownloadTaskList().getDownloadedPrimitives().isEmpty());
    3036    }
     37
     38    /**
     39     * Unit test of {@code DownloadTaskList#download} - empty cases.
     40     * @throws Exception in case of error
     41     */
     42    @Test
     43    public 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    }
    3155}
Note: See TracChangeset for help on using the changeset viewer.