Changeset 15047 in josm


Ignore:
Timestamp:
2019-05-04T19:36:04+02:00 (6 weeks ago)
Author:
Don-vip
Message:

see #17576 - update ExifReaderTest

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/test/unit/org/openstreetmap/josm/tools/ExifReaderTest.java

    r12746 r15047  
    1010import java.text.ParseException;
    1111import java.text.SimpleDateFormat;
    12 import java.time.ZoneId;
    1312import java.time.ZonedDateTime;
    1413import java.util.Date;
    15 import java.util.TimeZone;
    1614
    1715import org.junit.Before;
     
    2018import org.openstreetmap.josm.TestUtils;
    2119import org.openstreetmap.josm.data.coor.LatLon;
     20import org.openstreetmap.josm.data.coor.conversion.AbstractCoordinateFormat;
     21import org.openstreetmap.josm.data.coor.conversion.DMSCoordinateFormat;
    2222import org.openstreetmap.josm.testutils.JOSMTestRules;
    2323import org.openstreetmap.josm.tools.date.DateUtils;
    2424
    2525import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
    26 import org.openstreetmap.josm.data.coor.conversion.DMSCoordinateFormat;
    2726
    2827/**
     
    5655    public void testReadTime() throws ParseException {
    5756        Date date = ExifReader.readTime(directionSampleFile);
    58         assertEquals(ZonedDateTime.of(2010, 5, 15, 17, 12, 5, 0, ZoneId.systemDefault()).toInstant(), date.toInstant());
    59 
    60         final TimeZone zone = TimeZone.getTimeZone("Europe/Berlin");
    61         TimeZone.setDefault(zone);
    62         date = ExifReader.readTime(directionSampleFile);
    63         TimeZone.setDefault(DateUtils.UTC);
    64         assertEquals(ZonedDateTime.of(2010, 5, 15, 17, 12, 5, 0, zone.toZoneId()).toInstant(), date.toInstant());
     57        assertEquals(ZonedDateTime.of(2010, 5, 15, 17, 12, 5, 0, DateUtils.UTC.toZoneId()).toInstant(), date.toInstant());
    6558    }
    6659
     
    7366        Date date = ExifReader.readTime(new File("data_nodist/IMG_20150711_193419.jpg"));
    7467        doTest("2015-07-11T19:34:19.100", date);
    75 
    76         TimeZone.setDefault(TimeZone.getTimeZone("Europe/Berlin"));
    77         date = ExifReader.readTime(new File("data_nodist/IMG_20150711_193419.jpg"));
    78         TimeZone.setDefault(DateUtils.UTC);
    79         doTest("2015-07-11T17:34:19.100", date);
    8068    }
    8169
     
    10492        LatLon latlon = ExifReader.readLatLon(directionSampleFile);
    10593        assertNotNull(latlon);
    106         DecimalFormat f = new DecimalFormat("00.0");
     94        DecimalFormat f = AbstractCoordinateFormat.newUnlocalizedDecimalFormat("00.0");
    10795        assertEquals("51°46'"+f.format(43.0)+"\"", DMSCoordinateFormat.degreesMinutesSeconds(latlon.lat()));
    10896        assertEquals("8°21'"+f.format(56.3)+"\"", DMSCoordinateFormat.degreesMinutesSeconds(latlon.lon()));
Note: See TracChangeset for help on using the changeset viewer.