[BTA] Simplify assertions in argument conversion tests
diff --git a/compiler/build-tools/kotlin-build-tools-api-tests/src/testCompatibility/kotlin/arguments/Jsr305ConversionTest.kt b/compiler/build-tools/kotlin-build-tools-api-tests/src/testCompatibility/kotlin/arguments/Jsr305ConversionTest.kt index ec79fb1..55413d5 100644 --- a/compiler/build-tools/kotlin-build-tools-api-tests/src/testCompatibility/kotlin/arguments/Jsr305ConversionTest.kt +++ b/compiler/build-tools/kotlin-build-tools-api-tests/src/testCompatibility/kotlin/arguments/Jsr305ConversionTest.kt
@@ -66,7 +66,7 @@ val actualJsr305 = jvmOperation.compilerArguments[X_JSR305] - assertListEquals(expectedJsr305, actualJsr305) + assertEquals(expectedJsr305, actualJsr305) } @DisplayName("Jsr305 has the default value when not set") @@ -99,10 +99,7 @@ ) ) - assertListEquals( - expectedJsr305, - operation.compilerArguments[X_JSR305] - ) + assertEquals(expectedJsr305, operation.compilerArguments[X_JSR305]) } @DisplayName("Jsr305 has the default value when no raw arguments are applied") @@ -130,11 +127,4 @@ is Jsr305.SpecificAnnotation -> "${item.annotationFqName}:${item.mode.stringValue}" } } - - private fun assertListEquals(expected: List<Jsr305>, actual: List<Jsr305>) { - assertEquals(expected.size, actual.size) - expected.forEachIndexed { index, expectedItem -> - assertEquals(expectedItem, actual[index]) - } - } }
diff --git a/compiler/build-tools/kotlin-build-tools-api-tests/src/testCompatibility/kotlin/arguments/NullabilityAnnotationsConversionTest.kt b/compiler/build-tools/kotlin-build-tools-api-tests/src/testCompatibility/kotlin/arguments/NullabilityAnnotationsConversionTest.kt index 84ffbe8..43ae165 100644 --- a/compiler/build-tools/kotlin-build-tools-api-tests/src/testCompatibility/kotlin/arguments/NullabilityAnnotationsConversionTest.kt +++ b/compiler/build-tools/kotlin-build-tools-api-tests/src/testCompatibility/kotlin/arguments/NullabilityAnnotationsConversionTest.kt
@@ -64,7 +64,7 @@ val actualAnnotations = jvmOperation.compilerArguments[X_NULLABILITY_ANNOTATIONS] - assertListEquals(expectedAnnotations, actualAnnotations) + assertEquals(expectedAnnotations, actualAnnotations) } @DisplayName("NullabilityAnnotations has the default value when not set") @@ -96,7 +96,7 @@ ) ) - assertListEquals( + assertEquals( expectedAnnotations, operation.compilerArguments[X_NULLABILITY_ANNOTATIONS] ) @@ -121,15 +121,4 @@ override fun getValueString(argument: List<NullabilityAnnotation>?): String? = argument?.joinToString(",") { "${it.annotationFqName}:${it.mode.stringValue}" } - - private fun assertListEquals(expectedList: List<NullabilityAnnotation>, actualList: List<NullabilityAnnotation>) { - assertEquals(expectedList.size, actualList.size) - - expectedList.forEachIndexed { index, expected -> - val actual = actualList[index] - - assertEquals(expected.annotationFqName, actual.annotationFqName) - assertEquals(expected.mode.stringValue, actual.mode.stringValue) - } - } }
diff --git a/compiler/build-tools/kotlin-build-tools-api-tests/src/testCompatibility/kotlin/arguments/ProfileCompilerCommandConversionTest.kt b/compiler/build-tools/kotlin-build-tools-api-tests/src/testCompatibility/kotlin/arguments/ProfileCompilerCommandConversionTest.kt index b6aade6..f2132de 100644 --- a/compiler/build-tools/kotlin-build-tools-api-tests/src/testCompatibility/kotlin/arguments/ProfileCompilerCommandConversionTest.kt +++ b/compiler/build-tools/kotlin-build-tools-api-tests/src/testCompatibility/kotlin/arguments/ProfileCompilerCommandConversionTest.kt
@@ -66,9 +66,7 @@ val actualProfileCommand = jvmOperation.compilerArguments[X_PROFILE] - assertEquals(expectedProfileCommand.profilerPath, actualProfileCommand?.profilerPath) - assertEquals(expectedProfileCommand.command, actualProfileCommand?.command) - assertEquals(expectedProfileCommand.outputDir, actualProfileCommand?.outputDir) + assertEquals(expectedProfileCommand, actualProfileCommand) } @DisplayName("ProfileCompilerCommand has the default value when not set") @@ -102,9 +100,7 @@ ) val actualProfileCommand = operation.compilerArguments[X_PROFILE] - assertEquals(expectedProfileCommand.profilerPath, actualProfileCommand?.profilerPath) - assertEquals(expectedProfileCommand.command, actualProfileCommand?.command) - assertEquals(expectedProfileCommand.outputDir, actualProfileCommand?.outputDir) + assertEquals(expectedProfileCommand, actualProfileCommand) } @DisplayName("ProfileCompilerCommand has the default value when no raw arguments are applied")
diff --git a/compiler/build-tools/kotlin-build-tools-api-tests/src/testCompatibility/kotlin/arguments/WarningLevelConfigConversionTest.kt b/compiler/build-tools/kotlin-build-tools-api-tests/src/testCompatibility/kotlin/arguments/WarningLevelConfigConversionTest.kt index 158bbbf..6dab975 100644 --- a/compiler/build-tools/kotlin-build-tools-api-tests/src/testCompatibility/kotlin/arguments/WarningLevelConfigConversionTest.kt +++ b/compiler/build-tools/kotlin-build-tools-api-tests/src/testCompatibility/kotlin/arguments/WarningLevelConfigConversionTest.kt
@@ -76,7 +76,7 @@ val actualConfigs = jvmOperation.compilerArguments[X_WARNING_LEVEL] - assertListEquals(expectedConfigs, actualConfigs) + assertEquals(expectedConfigs, actualConfigs) } @DisplayName("WarningLevel has the default value when not set") @@ -110,7 +110,7 @@ ) ) - assertListEquals( + assertEquals( expectedConfigs, operation.compilerArguments[X_WARNING_LEVEL] ) @@ -137,17 +137,6 @@ override fun getValueString(argument: List<WarningLevel>?): String? = argument?.joinToString(",") { "${it.warningName}:${it.severity.stringValue}" } - private fun assertListEquals(expectedList: List<WarningLevel>, actualList: List<WarningLevel>) { - assertEquals(expectedList.size, actualList.size) - - expectedList.forEachIndexed { index, expected -> - val actual = actualList[index] - - assertEquals(expected.warningName, actual.warningName) - assertEquals(expected.severity.stringValue, actual.severity.stringValue) - } - } - private fun assumeWarningLevelSupported(compilerVersion: String) { assumeTrue( compilerVersion >= X_WARNING_LEVEL.availableSinceVersion.toString(),