|
21 | 21 | import static org.junit.Assert.assertThrows; |
22 | 22 |
|
23 | 23 | import java.math.BigDecimal; |
24 | | -import java.time.DateTimeException; |
25 | | -import java.time.Instant; |
26 | 24 | import java.util.Map; |
27 | 25 | import org.apache.beam.sdk.schemas.Schema; |
28 | 26 | import org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.ImmutableMap; |
29 | 27 | import org.apache.commons.collections.keyvalue.DefaultMapEntry; |
30 | 28 | import org.apache.commons.csv.CSVFormat; |
| 29 | +import org.joda.time.Instant; |
31 | 30 | import org.junit.Test; |
32 | 31 | import org.junit.runner.RunWith; |
33 | 32 | import org.junit.runners.JUnit4; |
@@ -382,20 +381,20 @@ public void givenFloatWithSurroundingSpaces_parses() { |
382 | 381 | } |
383 | 382 |
|
384 | 383 | @Test |
385 | | - public void givenDatetimeWithSurroundingSpaces() throws DateTimeException { |
| 384 | + public void givenDatetimeWithSurroundingSpaces() { |
386 | 385 | Instant datetime = Instant.parse("1234-01-23T10:00:05.000Z"); |
387 | 386 | DefaultMapEntry cellToExpectedValue = |
388 | 387 | new DefaultMapEntry(" 1234-01-23T10:00:05.000Z ", datetime); |
389 | 388 | Schema schema = |
390 | 389 | Schema.builder().addDateTimeField("a_datetime").addStringField("a_string").build(); |
391 | | - DateTimeException e = |
| 390 | + IllegalArgumentException e = |
392 | 391 | assertThrows( |
393 | | - DateTimeException.class, |
| 392 | + IllegalArgumentException.class, |
394 | 393 | () -> |
395 | 394 | CsvIOParseHelpers.parseCell( |
396 | 395 | cellToExpectedValue.getKey().toString(), schema.getField("a_datetime"))); |
397 | 396 | assertEquals( |
398 | | - "Text " + "' 1234-01-23T10:00:05.000Z '" + " could not be parsed at index 0", |
| 397 | + "Invalid format: \" 1234-01-23T10:00:05.000Z \" field a_datetime was received -- type mismatch", |
399 | 398 | e.getMessage()); |
400 | 399 | } |
401 | 400 |
|
|
0 commit comments