File tree 1 file changed +4
-4
lines changed 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -236,15 +236,15 @@ class DateTimeComponentsFormatTest {
236
236
offset(UtcOffset .Formats .ISO )
237
237
}
238
238
for (index in fields.indices) {
239
- try {
239
+ val propertyName = fields[index].property.name
240
+ assertFailsWith<IllegalStateException >(" No error if the field $propertyName is unset" ) {
240
241
formatWithEverything.format {
241
242
for (i in fields.indices) {
242
243
if (i != index) fields[i].set(this )
243
244
}
244
245
}
245
- fail(" No error if the field ${fields[index].property.name} is unset" )
246
- } catch (e: IllegalStateException ) {
247
- assertTrue(e.message!! .contains(fields[index].property.name), " Error message '$e ' does not contain ${fields[index].property.name} " )
246
+ }.let {
247
+ assertTrue(it.message!! .contains(fields[index].property.name), " Error message '$it ' does not contain $propertyName " )
248
248
}
249
249
}
250
250
}
You can’t perform that action at this time.
0 commit comments