Changeset 12714 in josm for trunk/test
- Timestamp:
- 2017-09-03T21:14:05+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/test/unit/org/openstreetmap/josm/io/OverpassDownloadReaderTest.java
r12557 r12714 7 7 import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options; 8 8 import static org.junit.Assert.assertEquals; 9 import static org.junit.Assert.assertNotNull; 9 10 import static org.junit.Assert.assertTrue; 10 11 12 import java.time.LocalDateTime; 11 13 import java.util.regex.Matcher; 12 14 … … 20 22 import org.openstreetmap.josm.tools.OverpassTurboQueryWizard; 21 23 import org.openstreetmap.josm.tools.Utils; 24 import org.openstreetmap.josm.tools.date.DateUtils; 22 25 23 26 import com.github.tomakehurst.wiremock.junit.WireMockRule; … … 87 90 88 91 /** 92 * Tests evaluating the extended query feature {@code date}. 93 */ 94 @Test 95 public void testDate() { 96 LocalDateTime from = LocalDateTime.of(2017, 7, 14, 2, 40); 97 assertEquals("2016-07-14T02:40:00Z", OverpassDownloadReader.date("1 year", from)); 98 assertEquals("2007-07-14T02:40:00Z", OverpassDownloadReader.date("10years", from)); 99 assertEquals("2017-06-14T02:40:00Z", OverpassDownloadReader.date("1 month", from)); 100 assertEquals("2016-09-14T02:40:00Z", OverpassDownloadReader.date("10months", from)); 101 assertEquals("2017-07-07T02:40:00Z", OverpassDownloadReader.date("1 week", from)); 102 assertEquals("2017-05-05T02:40:00Z", OverpassDownloadReader.date("10weeks", from)); 103 assertEquals("2017-07-13T02:40:00Z", OverpassDownloadReader.date("1 day", from)); 104 assertEquals("2017-07-04T02:40:00Z", OverpassDownloadReader.date("10days", from)); 105 assertEquals("2017-07-14T01:40:00Z", OverpassDownloadReader.date("1 hour", from)); 106 assertEquals("2017-07-13T16:40:00Z", OverpassDownloadReader.date("10hours", from)); 107 assertEquals("2017-07-14T02:39:00Z", OverpassDownloadReader.date("1 minute", from)); 108 assertEquals("2017-07-14T02:30:00Z", OverpassDownloadReader.date("10minutes", from)); 109 assertEquals("2017-07-14T02:39:59Z", OverpassDownloadReader.date("1 second", from)); 110 assertEquals("2017-07-14T02:39:50Z", OverpassDownloadReader.date("10seconds", from)); 111 112 assertEquals("2016-07-13T02:40:00Z", OverpassDownloadReader.date("1 year 1 day", from)); 113 assertEquals("2016-07-14T02:38:20Z", OverpassDownloadReader.date("1 year 100 seconds", from)); 114 assertEquals("2017-07-13T02:38:20Z", OverpassDownloadReader.date("1 day 100 seconds", from)); 115 } 116 117 /** 118 * Tests evaluating the extended query feature {@code date} through {@code newer:} operator. 119 */ 120 @Test 121 public void testDateNewer() { 122 final String query = getExpandedQuery("type:node and newer:3minutes"); 123 String statement = query.substring(query.indexOf("node(newer:\"") + 12, query.lastIndexOf("\");")); 124 assertNotNull(DateUtils.fromString(statement)); 125 } 126 127 /** 89 128 * Tests evaluating the extended query feature {@code geocodeArea}. 90 129 */
Note:
See TracChangeset
for help on using the changeset viewer.