Ignore:
Timestamp:
2018-08-28T21:29:03+02:00 (6 years ago)
Author:
Don-vip
Message:

see #16688 - skip some unit tests if preconditions are not met

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/functional/org/openstreetmap/josm/io/MultiFetchServerObjectReaderTest.java

    r12850 r14190  
    2222import java.util.logging.Logger;
    2323
     24import org.junit.Assume;
    2425import org.junit.Before;
    2526import org.junit.BeforeClass;
     
    2829import org.junit.rules.Timeout;
    2930import org.openstreetmap.josm.JOSMFixture;
     31import org.openstreetmap.josm.TestUtils;
    3032import org.openstreetmap.josm.data.coor.LatLon;
    3133import org.openstreetmap.josm.data.osm.Changeset;
     
    150152    @BeforeClass
    151153    public static void init() throws Exception {
     154        if (!TestUtils.areCredentialsProvided()) {
     155            logger.severe("OSM DEV API credentials not provided. Please define them with -Dosm.username and -Dosm.password");
     156            return;
     157        }
    152158        logger.info("initializing ...");
    153159        JOSMFixture.createFunctionalTestFixture().init();
     
    200206    @Before
    201207    public void setUp() throws IOException, IllegalDataException, FileNotFoundException {
     208        if (!TestUtils.areCredentialsProvided()) {
     209            return;
     210        }
    202211        File f = new File(System.getProperty("java.io.tmpdir"), MultiFetchServerObjectReaderTest.class.getName() + ".dataset");
    203212        logger.info(MessageFormat.format("reading cached dataset ''{0}''", f.toString()));
     
    214223    @Test
    215224    public void testMultiGet10Nodes() throws OsmTransferException {
     225        Assume.assumeTrue(TestUtils.areCredentialsProvided());
    216226        MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader();
    217227        ArrayList<Node> nodes = new ArrayList<>(ds.getNodes());
     
    235245    @Test
    236246    public void testMultiGet10Ways() throws OsmTransferException {
     247        Assume.assumeTrue(TestUtils.areCredentialsProvided());
    237248        MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader();
    238249        ArrayList<Way> ways = new ArrayList<>(ds.getWays());
     
    257268    @Test
    258269    public void testMultiGet10Relations() throws OsmTransferException {
     270        Assume.assumeTrue(TestUtils.areCredentialsProvided());
    259271        MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader();
    260272        ArrayList<Relation> relations = new ArrayList<>(ds.getRelations());
     
    279291    @Test
    280292    public void testMultiGet800Nodes() throws OsmTransferException {
     293        Assume.assumeTrue(TestUtils.areCredentialsProvided());
    281294        MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader();
    282295        ArrayList<Node> nodes = new ArrayList<>(ds.getNodes());
     
    300313    @Test
    301314    public void testMultiGetWithNonExistingNode() throws OsmTransferException {
     315        Assume.assumeTrue(TestUtils.areCredentialsProvided());
    302316        MultiFetchServerObjectReader reader = new MultiFetchServerObjectReader();
    303317        ArrayList<Node> nodes = new ArrayList<>(ds.getNodes());
Note: See TracChangeset for help on using the changeset viewer.