@@ -32,13 +32,13 @@ class DateTimeComponentsFormatTest {
32
32
setOffset(UtcOffset .ZERO )
33
33
},
34
34
format.parse(" Tue, 40 Jun 2008 11:05:30 GMT" ))
35
- assertFailsWith< DateTimeFormatException > { format.parse (" Bue, 3 Jun 2008 11:05:30 GMT" ) }
35
+ format.assertCanNotParse (" Bue, 3 Jun 2008 11:05:30 GMT" )
36
36
}
37
37
38
38
@Test
39
39
fun testInconsistentLocalTime () {
40
40
val formatTime = LocalTime .Format {
41
- hour(); char(' :' ); minute();
41
+ hour(); char(' :' ); minute()
42
42
chars(" (" ); amPmHour(); char(' :' ); minute(); char(' ' ); amPmMarker(" AM" , " PM" ); char(' )' )
43
43
}
44
44
val format = DateTimeComponents .Format { time(formatTime) }
@@ -53,16 +53,16 @@ class DateTimeComponentsFormatTest {
53
53
DateTimeComponents ().apply { hour = 23 ; hourOfAmPm = 11 ; minute = 15 ; amPm = AmPmMarker .AM },
54
54
format.parse(time2)
55
55
)
56
- assertFailsWith< IllegalArgumentException > { formatTime.parse (time2) }
56
+ formatTime.assertCanNotParse (time2)
57
57
val time3 = " 23:15 (10:15 PM)" // a time with an inconsistent number of hours
58
58
assertDateTimeComponentsEqual(
59
59
DateTimeComponents ().apply { hour = 23 ; hourOfAmPm = 10 ; minute = 15 ; amPm = AmPmMarker .PM },
60
60
format.parse(time3)
61
61
)
62
- assertFailsWith< IllegalArgumentException > { formatTime.parse (time3) }
62
+ formatTime.assertCanNotParse (time3)
63
63
val time4 = " 23:15 (11:16 PM)" // a time with an inconsistently duplicated field
64
- assertFailsWith< IllegalArgumentException > { format.parse (time4) }
65
- assertFailsWith< IllegalArgumentException > { formatTime.parse (time4) }
64
+ format.assertCanNotParse (time4)
65
+ formatTime.assertCanNotParse (time4)
66
66
}
67
67
68
68
@Test
@@ -95,7 +95,7 @@ class DateTimeComponentsFormatTest {
95
95
assertEquals(dateTime, bag.toLocalDateTime())
96
96
assertEquals(offset, bag.toUtcOffset())
97
97
assertEquals(berlin, bag.timeZoneId)
98
- assertFailsWith< DateTimeFormatException > { format.parse (" 2008-06-03T11:05:30.123456789+01:00[Mars/New_York]" ) }
98
+ format.assertCanNotParse (" 2008-06-03T11:05:30.123456789+01:00[Mars/New_York]" )
99
99
for (zone in TimeZone .availableZoneIds) {
100
100
assertEquals(zone, format.parse(" 2008-06-03T11:05:30.123456789+01:00[$zone ]" ).timeZoneId)
101
101
}
0 commit comments