Ignore:
Timestamp:
2019-02-22T22:35:25+01:00 (5 years ago)
Author:
Don-vip
Message:

fix #17367 - NPE

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/data/gpx/GpxImageCorrelationTest.java

    r14205 r14797  
    44import static org.junit.Assert.assertEquals;
    55import static org.junit.Assert.assertFalse;
     6import static org.junit.Assert.assertNull;
    67import static org.junit.Assert.assertTrue;
    78
     
    1415import org.openstreetmap.josm.TestUtils;
    1516import org.openstreetmap.josm.data.coor.CachedLatLon;
     17import org.openstreetmap.josm.data.coor.LatLon;
    1618import org.openstreetmap.josm.io.GpxReaderTest;
    1719import org.openstreetmap.josm.spi.preferences.Config;
     
    267269        }
    268270    }
     271
     272    /**
     273     * Unit test of {@link GpxImageCorrelation#getElevation}
     274     */
     275    @Test
     276    public void testGetElevation() {
     277        assertNull(GpxImageCorrelation.getElevation(null));
     278        WayPoint wp = new WayPoint(LatLon.ZERO);
     279        assertNull(GpxImageCorrelation.getElevation(wp));
     280        wp.put(GpxConstants.PT_ELE, "");
     281        assertNull(GpxImageCorrelation.getElevation(wp));
     282        wp.put(GpxConstants.PT_ELE, "not a number");
     283        assertNull(GpxImageCorrelation.getElevation(wp));
     284        wp.put(GpxConstants.PT_ELE, "150.0");
     285        assertEquals(Double.valueOf(150.0d), GpxImageCorrelation.getElevation(wp));
     286    }
    269287}
Note: See TracChangeset for help on using the changeset viewer.