Ignore:
Timestamp:
2016-01-10T13:48:42+01:00 (4 years ago)
Author:
simon04
Message:

Refactoring: introduce UncheckedParseException

In addition, DateUtils#fromString does no longer return "now" when
date cannot be parsed, but throws an UncheckedParseException instead.

File:
1 edited

Legend:

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

    r9383 r9385  
    44import static org.junit.Assert.assertEquals;
    55
     6import java.util.Date;
    67import java.util.TimeZone;
    78
    89import org.junit.BeforeClass;
    910import org.junit.Test;
     11import org.openstreetmap.josm.tools.UncheckedParseException;
    1012
    1113/**
     
    6567        assertEquals(-1041337172130L, DateUtils.fromString("1937-01-01T12:00:27.87+00:20").getTime());
    6668    }
     69
     70    /**
     71     * Verifies that parsing an illegal date throws a {@link UncheckedParseException}
     72     */
     73    @Test(expected = UncheckedParseException.class)
     74    public void testIllegalDate() {
     75        DateUtils.fromString("2014-");
     76    }
    6777}
Note: See TracChangeset for help on using the changeset viewer.