Skip to content

Commit 4a4a546

Browse files
chore: Fix deprecations
1 parent 9ac3b37 commit 4a4a546

1 file changed

Lines changed: 39 additions & 28 deletions

File tree

src/test/kotlin/dev/turingcomplete/intellijdevelopertoolsplugin/integrationtest/DeveloperToolsInstanceSettingsTest.kt

Lines changed: 39 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ class DeveloperToolsInstanceSettingsTest : IdeaTest() {
215215
.use { writer ->
216216
CSVPrinter(
217217
writer,
218-
expectedConfigurationPropertiesCsvFormat.builder().setSkipHeaderRecord(false).build(),
218+
expectedConfigurationPropertiesCsvFormat.builder().setSkipHeaderRecord(false).get(),
219219
)
220220
.use { printer ->
221221
settings
@@ -358,8 +358,7 @@ class DeveloperToolsInstanceSettingsTest : IdeaTest() {
358358
.apply { writeText("") }
359359
.writer(options = arrayOf(StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING))
360360
.use { writer ->
361-
val csvPrinter =
362-
CSVPrinter(writer, csvFormat.builder().setSkipHeaderRecord(false).build())
361+
val csvPrinter = CSVPrinter(writer, csvFormat.builder().setSkipHeaderRecord(false).get())
363362
writeProperties(csvPrinter)
364363
}
365364
}
@@ -489,16 +488,22 @@ class DeveloperToolsInstanceSettingsTest : IdeaTest() {
489488
expectedConfigurationPropertiesCsvFile: Path
490489
): List<ExpectedConfigurationProperty> =
491490
expectedConfigurationPropertiesCsvFile.bufferedReader().use { reader ->
492-
CSVParser(reader, expectedConfigurationPropertiesCsvFormat).records.map { record ->
493-
val developerToolId = record[CSV_HEADER_DEVELOPER_TOOL_ID]
494-
ExpectedConfigurationProperty(
495-
developerToolId = developerToolId,
496-
propertyKey = record[CSV_HEADER_PROPERTY_KEY],
497-
propertyValueType = record[CSV_HEADER_PROPERTY_VALUE_TYPE_NAME],
498-
propertyValue = record[CSV_HEADER_PROPERTY_VALUE].replace("\r\n", System.lineSeparator()),
499-
propertyType = record[CSV_HEADER_PROPERTY_TYPE],
500-
)
501-
}
491+
CSVParser.builder()
492+
.setReader(reader)
493+
.setFormat(expectedConfigurationPropertiesCsvFormat)
494+
.get()
495+
.records
496+
.map { record ->
497+
val developerToolId = record[CSV_HEADER_DEVELOPER_TOOL_ID]
498+
ExpectedConfigurationProperty(
499+
developerToolId = developerToolId,
500+
propertyKey = record[CSV_HEADER_PROPERTY_KEY],
501+
propertyValueType = record[CSV_HEADER_PROPERTY_VALUE_TYPE_NAME],
502+
propertyValue =
503+
record[CSV_HEADER_PROPERTY_VALUE].replace("\r\n", System.lineSeparator()),
504+
propertyType = record[CSV_HEADER_PROPERTY_TYPE],
505+
)
506+
}
502507
}
503508

504509
private fun applyRenamedConfigurationPropertyKeys(
@@ -540,13 +545,18 @@ class DeveloperToolsInstanceSettingsTest : IdeaTest() {
540545

541546
val properties =
542547
csvFile.bufferedReader().use { reader ->
543-
CSVParser(reader, renamedConfigurationPropertiesCsvFormat).records.map {
544-
Triple(
545-
it.get(CSV_HEADER_DEVELOPER_TOOL_ID),
546-
it.get(CSV_HEADER_OLD_PROPERTY_KEY),
547-
it.get(CSV_HEADER_NEW_PROPERTY_KEY),
548-
)
549-
}
548+
CSVParser.builder()
549+
.setReader(reader)
550+
.setFormat(renamedConfigurationPropertiesCsvFormat)
551+
.get()
552+
.records
553+
.map {
554+
Triple(
555+
it.get(CSV_HEADER_DEVELOPER_TOOL_ID),
556+
it.get(CSV_HEADER_OLD_PROPERTY_KEY),
557+
it.get(CSV_HEADER_NEW_PROPERTY_KEY),
558+
)
559+
}
550560
}
551561

552562
dir.name.toPluginVersion() to properties
@@ -570,11 +580,12 @@ class DeveloperToolsInstanceSettingsTest : IdeaTest() {
570580

571581
val properties =
572582
csvFile.bufferedReader().use { reader ->
573-
CSVParser(reader, removedConfigurationPropertiesCsvFormat).records.groupBy({
574-
it.get(CSV_HEADER_DEVELOPER_TOOL_ID)
575-
}) {
576-
it.get(CSV_HEADER_PROPERTY_KEY)
577-
}
583+
CSVParser.builder()
584+
.setReader(reader)
585+
.setFormat(removedConfigurationPropertiesCsvFormat)
586+
.get()
587+
.records
588+
.groupBy({ it.get(CSV_HEADER_DEVELOPER_TOOL_ID) }) { it.get(CSV_HEADER_PROPERTY_KEY) }
578589
}
579590

580591
dir.name.toPluginVersion() to properties
@@ -633,7 +644,7 @@ class DeveloperToolsInstanceSettingsTest : IdeaTest() {
633644
CSV_HEADER_PROPERTY_VALUE,
634645
)
635646
.setSkipHeaderRecord(true)
636-
.build()
647+
.get()
637648

638649
private val renamedConfigurationPropertiesCsvFormat =
639650
CSVFormat.Builder.create()
@@ -643,12 +654,12 @@ class DeveloperToolsInstanceSettingsTest : IdeaTest() {
643654
CSV_HEADER_NEW_PROPERTY_KEY,
644655
)
645656
.setSkipHeaderRecord(true)
646-
.build()
657+
.get()
647658

648659
private val removedConfigurationPropertiesCsvFormat =
649660
CSVFormat.Builder.create()
650661
.setHeader(CSV_HEADER_DEVELOPER_TOOL_ID, CSV_HEADER_PROPERTY_KEY)
651662
.setSkipHeaderRecord(true)
652-
.build()
663+
.get()
653664
}
654665
}

0 commit comments

Comments
 (0)