Changeset 15869 in josm for trunk/src


Ignore:
Timestamp:
2020-02-16T23:42:59+01:00 (5 years ago)
Author:
simon04
Message:

DateUtilsTest: extend

Based on test coverage and mutation testing using Pitest.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/tools/date/DateUtils.java

    r15250 r15869  
    104104            if (str.length() == 22 || str.length() == 25) {
    105105                final int plusHr = parsePart2(str, 20);
    106                 final long mul = str.charAt(19) == '+' ? -1 : 1;
    107                 return local.plusHours(plusHr * mul).toInstant().toEpochMilli();
     106                return local.plusHours(str.charAt(19) == '+' ? -plusHr : plusHr).toInstant().toEpochMilli();
    108107            }
    109108            return local.toInstant().toEpochMilli();
     
    125124            if (str.length() == 29) {
    126125                final int plusHr = parsePart2(str, 24);
    127                 final long mul = str.charAt(23) == '+' ? -1 : 1;
    128                 return local.plusHours(plusHr * mul).toInstant().toEpochMilli();
     126                return local.plusHours(str.charAt(23) == '+' ? -plusHr : plusHr).toInstant().toEpochMilli();
    129127            }
    130128            return local.toInstant().toEpochMilli();
Note: See TracChangeset for help on using the changeset viewer.