From eedb69b5e4371e025d06392a2b7fd6a5b96f0066 Mon Sep 17 00:00:00 2001 From: Andrey Uskov Date: Thu, 22 Nov 2018 20:18:03 +0300 Subject: [PATCH] Improve diagnostics in GradleInspectionTest --- .../gradle/GradleInspectionTest.kt | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleInspectionTest.kt b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleInspectionTest.kt index 9914b00360d..d5d09b0523f 100644 --- a/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleInspectionTest.kt +++ b/idea/idea-gradle/tests/org/jetbrains/kotlin/idea/codeInsight/gradle/GradleInspectionTest.kt @@ -32,7 +32,7 @@ class GradleInspectionTest : GradleImportingTestCase() { fun testDifferentStdlibGradleVersion() { val problems = getInspectionResultFromTestDataProject() - Assert.assertTrue(problems.size == 1) + Assert.assertEquals(1, problems.size) Assert.assertEquals("Plugin version (1.0.2) is not the same as library version (1.0.3)", problems.single()) } @@ -40,7 +40,7 @@ class GradleInspectionTest : GradleImportingTestCase() { fun testDifferentStdlibGradleVersionWithImplementation() { val problems = getInspectionResultFromTestDataProject() - Assert.assertTrue(problems.size == 1) + Assert.assertEquals(1, problems.size) Assert.assertEquals("Plugin version (1.0.2) is not the same as library version (1.0.3)", problems.single()) } @@ -48,7 +48,7 @@ class GradleInspectionTest : GradleImportingTestCase() { fun testDifferentStdlibJre7GradleVersion() { val problems = getInspectionResultFromTestDataProject() - Assert.assertTrue(problems.size == 1) + Assert.assertEquals(1, problems.size) Assert.assertEquals("Plugin version (1.1.0-beta-17) is not the same as library version (1.1.0-beta-22)", problems.single()) } @@ -56,7 +56,7 @@ class GradleInspectionTest : GradleImportingTestCase() { fun testDifferentStdlibJdk7GradleVersion() { val problems = getInspectionResultFromTestDataProject() - Assert.assertTrue(problems.size == 1) + Assert.assertEquals(1, problems.size) Assert.assertEquals("Plugin version (1.1.0-beta-17) is not the same as library version (1.1.0-beta-22)", problems.single()) } @@ -64,7 +64,7 @@ class GradleInspectionTest : GradleImportingTestCase() { fun testDifferentStdlibGradleVersionWithVariables() { val problems = getInspectionResultFromTestDataProject() - Assert.assertTrue(problems.size == 1) + Assert.assertEquals(1, problems.size) Assert.assertEquals("Plugin version (1.0.1) is not the same as library version (1.0.3)", problems.single()) } @@ -74,7 +74,7 @@ class GradleInspectionTest : GradleImportingTestCase() { tool.testVersionMessage = "\$PLUGIN_VERSION" val problems = getInspectionResultFromTestDataProject(tool) - Assert.assertTrue(problems.size == 1) + Assert.assertEquals(1, problems.size) Assert.assertEquals( "Kotlin version that is used for building with Gradle (1.0.1) differs from the one bundled into the IDE plugin (\$PLUGIN_VERSION)", problems.single() @@ -84,15 +84,14 @@ class GradleInspectionTest : GradleImportingTestCase() { @Test fun testJreInOldVersion() { val problems = getInspectionResultFromTestDataProject() - - Assert.assertTrue(problems.isEmpty()) + Assert.assertTrue("The inspection result should be empty but contains the following elements: [$problems].", problems.isEmpty()) } @Test fun testJreIsDeprecated() { val problems = getInspectionResultFromTestDataProject() - Assert.assertTrue(problems.size == 1) + Assert.assertEquals(1, problems.size) Assert.assertEquals( "kotlin-stdlib-jre7 is deprecated since 1.2.0 and should be replaced with kotlin-stdlib-jdk7", problems.single() @@ -103,7 +102,7 @@ class GradleInspectionTest : GradleImportingTestCase() { fun testJreIsDeprecatedWithImplementation() { val problems = getInspectionResultFromTestDataProject() - Assert.assertTrue(problems.size == 1) + Assert.assertEquals(1, problems.size) Assert.assertEquals( "kotlin-stdlib-jre7 is deprecated since 1.2.0 and should be replaced with kotlin-stdlib-jdk7", problems.single() @@ -115,7 +114,7 @@ class GradleInspectionTest : GradleImportingTestCase() { fun testJreIsDeprecatedWithoutImplicitVersion() { val problems = getInspectionResultFromTestDataProject() - Assert.assertTrue(problems.size == 1) + Assert.assertEquals(1, problems.size) Assert.assertEquals( "kotlin-stdlib-jre8 is deprecated since 1.2.0 and should be replaced with kotlin-stdlib-jdk8", problems.single() @@ -126,14 +125,14 @@ class GradleInspectionTest : GradleImportingTestCase() { fun testNoDifferentStdlibCommonGradleVersion() { val problems = getInspectionResultFromTestDataProject() - Assert.assertTrue(problems.toString(), problems.isEmpty()) + Assert.assertTrue("The inspection result should be empty but contains the following elements: [$problems].", problems.isEmpty()) } @Test fun testNoDifferentStdlibJdk7GradleVersion() { val problems = getInspectionResultFromTestDataProject() - Assert.assertTrue(problems.toString(), problems.isEmpty()) + Assert.assertTrue("The inspection result should be empty but contains the following elements: [$problems].", problems.isEmpty()) } @Test