Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhance smoke tests #1766

Merged
merged 12 commits into from
Oct 27, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.saveourtool.diktat.common.config.rules.RulesConfig
import com.saveourtool.diktat.ruleset.constants.Warnings.HEADER_MISSING_OR_WRONG_COPYRIGHT
import com.saveourtool.diktat.ruleset.constants.Warnings.HEADER_WRONG_FORMAT
import com.saveourtool.diktat.ruleset.rules.chapter2.comments.HeaderCommentRule
import com.saveourtool.diktat.test.framework.processing.ResourceReader
import com.saveourtool.diktat.test.framework.processing.ResourceReader.Companion.withReplacements
import com.saveourtool.diktat.util.FixTestBase

import generated.WarningNames
Expand All @@ -31,13 +31,13 @@ class HeaderCommentRuleFixTest : FixTestBase(
@Test
@Tag(WarningNames.HEADER_WRONG_FORMAT)
fun `new line should be inserted after header KDoc`(@TempDir tempDir: Path) {
fixAndCompare("NewlineAfterHeaderKdocExpected.kt", "NewlineAfterHeaderKdocTest.kt", resourceReader = ResourceReader.withReplacements(tempDir, currentYearReplacement))
fixAndCompare("NewlineAfterHeaderKdocExpected.kt", "NewlineAfterHeaderKdocTest.kt", overrideResourceReader = { it.withReplacements(tempDir, currentYearReplacement) })
}

@Test
@Tag(WarningNames.HEADER_MISSING_OR_WRONG_COPYRIGHT)
fun `if no copyright is present and mandatoryCopyright=true, it is added`(@TempDir tempDir: Path) {
fixAndCompare("AutoCopyrightExpected.kt", "AutoCopyrightTest.kt", resourceReader = ResourceReader.withReplacements(tempDir, currentYearReplacement))
fixAndCompare("AutoCopyrightExpected.kt", "AutoCopyrightTest.kt", overrideResourceReader = { it.withReplacements(tempDir, currentYearReplacement) })
}

@Test
Expand All @@ -54,7 +54,7 @@ class HeaderCommentRuleFixTest : FixTestBase(
),
RulesConfig(HEADER_WRONG_FORMAT.name, true, emptyMap())
),
resourceReader = ResourceReader.withReplacements(tempDir, currentYearReplacement),
overrideResourceReader = { it.withReplacements(tempDir, currentYearReplacement) },
)
}

Expand All @@ -64,15 +64,15 @@ class HeaderCommentRuleFixTest : FixTestBase(
@Test
@Tag(WarningNames.HEADER_NOT_BEFORE_PACKAGE)
fun `header KDoc should be moved before package`(@TempDir tempDir: Path) {
fixAndCompare("MisplacedHeaderKdocExpected.kt", "MisplacedHeaderKdocTest.kt", resourceReader = ResourceReader.withReplacements(tempDir, currentYearReplacement))
fixAndCompare("MisplacedHeaderKdocExpected.kt", "MisplacedHeaderKdocTest.kt", overrideResourceReader = { it.withReplacements(tempDir, currentYearReplacement) })
}

@Test
@Tags(Tag(WarningNames.HEADER_MISSING_OR_WRONG_COPYRIGHT), Tag(WarningNames.HEADER_WRONG_FORMAT))
fun `header KDoc should be moved before package - no copyright`(@TempDir tempDir: Path) {
fixAndCompare("MisplacedHeaderKdocNoCopyrightExpected.kt", "MisplacedHeaderKdocNoCopyrightTest.kt",
listOf(RulesConfig(HEADER_MISSING_OR_WRONG_COPYRIGHT.name, false, emptyMap()), RulesConfig(HEADER_WRONG_FORMAT.name, true, emptyMap())),
resourceReader = ResourceReader.withReplacements(tempDir, currentYearReplacement),
overrideResourceReader = { it.withReplacements(tempDir, currentYearReplacement) },
)
}

Expand All @@ -82,7 +82,7 @@ class HeaderCommentRuleFixTest : FixTestBase(
fixAndCompare(
"MisplacedHeaderKdocAppendedCopyrightExpected.kt",
"MisplacedHeaderKdocAppendedCopyrightTest.kt",
resourceReader = ResourceReader.withReplacements(tempDir, currentYearReplacement),
overrideResourceReader = { it.withReplacements(tempDir, currentYearReplacement) },
)
}

Expand All @@ -94,7 +94,7 @@ class HeaderCommentRuleFixTest : FixTestBase(
"isCopyrightMandatory" to "true",
"copyrightText" to "Copyright (c) My Company., Ltd. 2012-2019. All rights reserved."
))),
resourceReader = ResourceReader.withReplacements(tempDir, currentYearReplacement),
overrideResourceReader = { it.withReplacements(tempDir, currentYearReplacement) },
)
}

Expand All @@ -106,7 +106,7 @@ class HeaderCommentRuleFixTest : FixTestBase(
"isCopyrightMandatory" to "true",
"copyrightText" to "Copyright (c) My Company., Ltd. 2021. All rights reserved."
))),
resourceReader = ResourceReader.withReplacements(tempDir, currentYearReplacement),
overrideResourceReader = { it.withReplacements(tempDir, currentYearReplacement) },
)
}

Expand All @@ -118,7 +118,7 @@ class HeaderCommentRuleFixTest : FixTestBase(
"isCopyrightMandatory" to "true",
"copyrightText" to "Copyright (c) My Company., Ltd. 2012-2019. All rights reserved."
))),
resourceReader = ResourceReader.withReplacements(tempDir, currentYearReplacement),
overrideResourceReader = { it.withReplacements(tempDir, currentYearReplacement) },
)
}

Expand All @@ -130,7 +130,7 @@ class HeaderCommentRuleFixTest : FixTestBase(
"isCopyrightMandatory" to "true",
"copyrightText" to "Copyright (c) My Company., Ltd. 2012-2019. All rights reserved."
))),
resourceReader = ResourceReader.withReplacements(tempDir, currentYearReplacement),
overrideResourceReader = { it.withReplacements(tempDir, currentYearReplacement) },
)
}

Expand All @@ -142,7 +142,7 @@ class HeaderCommentRuleFixTest : FixTestBase(
"isCopyrightMandatory" to "true",
"copyrightText" to "Copyright (c) My Company., Ltd. 2012-2021. All rights reserved."
))),
resourceReader = ResourceReader.withReplacements(tempDir, currentYearReplacement),
overrideResourceReader = { it.withReplacements(tempDir, currentYearReplacement) },
)
}

Expand All @@ -168,7 +168,7 @@ class HeaderCommentRuleFixTest : FixTestBase(
| limitations under the License.
""".trimMargin()
))),
resourceReader = ResourceReader.withReplacements(tempDir, currentYearReplacement),
overrideResourceReader = { it.withReplacements(tempDir, currentYearReplacement) },
)
}

Expand All @@ -186,7 +186,7 @@ class HeaderCommentRuleFixTest : FixTestBase(
| You may obtain a copy of the License at
""".trimMargin()
))),
resourceReader = ResourceReader.withReplacements(tempDir, currentYearReplacement),
overrideResourceReader = { it.withReplacements(tempDir, currentYearReplacement) },
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,18 @@ open class FixTestBase(
* @param expectedPath path to file with expected result, relative to [resourceFilePath]
* @param testPath path to file with code that will be transformed by formatter, relative to [resourceFilePath]
* @param overrideRulesConfigList optional override to [defaultRulesConfigList]
* @param resourceReader [ResourceReader] to read resource content.
* @param overrideResourceReader [ResourceReader] to read resource content.
* @see fixAndCompareContent
*/
protected fun fixAndCompare(
expectedPath: String,
testPath: String,
overrideRulesConfigList: List<RulesConfig>? = null,
resourceReader: ResourceReader = ResourceReader.default,
overrideResourceReader: (ResourceReader) -> ResourceReader = { it },
) {
val testComparatorUnit = testComparatorUnitSupplier(overrideRulesConfigList)
val result = testComparatorUnit
.compareFilesFromResources(expectedPath, testPath, resourceReader)
.compareFilesFromResources(expectedPath, testPath, overrideResourceReader)
if (!result.isSuccessful) {
Assertions.assertEquals(
result.expectedContentWithoutWarns,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.saveourtool.diktat.ktlint.format
import com.saveourtool.diktat.ruleset.rules.DiktatRuleConfigReaderImpl
import com.saveourtool.diktat.ruleset.rules.DiktatRuleSetFactoryImpl
import com.saveourtool.diktat.test.framework.processing.ResourceReader
import com.saveourtool.diktat.test.framework.processing.TestComparatorUnit
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeEach
Expand All @@ -23,11 +24,17 @@
expected: String,
test: String,
) {
Assertions.assertTrue(
getTestComparatorUnit(config)
.compareFilesFromResources(expected, test)
.isSuccessful
val result = getTestComparatorUnit(config)
.compareFilesFromResources(expected, test)
Assertions.assertAll(

Check failure on line 29 in diktat-ruleset/src/test/kotlin/com/saveourtool/diktat/ruleset/smoke/DiktatSmokeTest.kt

View workflow job for this annotation

GitHub Actions / JUnit Tests (macOS, dorny/test-reporter@v1)

com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest ► fix can cause long line()

Failed test found in: diktat-ruleset/build/test-results/test/TEST-com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest.xml Error: org.gradle.internal.exceptions.DefaultMultiCauseException: Multiple Failures (2 failures)
Raw output
org.gradle.internal.exceptions.DefaultMultiCauseException: Multiple Failures (2 failures)
	org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
	org.opentest4j.AssertionFailedError: expected: <package com.saveourtool.diktat

fun foo() {
    (1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31
    ?: 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 ?: 40 or 41 or 42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 + 54 or 55 or 56 or 57 or 58 or 59
    ?: 60 or 61 or 62 or 63 or 64 or 65 or 66 - 67 or 68 or 69 or 70 or 1 + 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 + 19 -
        20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 || 42 or 43 or 44 or 45 or 46 or 47 && 48 or 49 ||
        50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or
            12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 or
            42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70)
}
> but was: <package com.saveourtool.diktat

fun foo() {
    (1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31
    ?: 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 ?: 40 or 41 or 42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 + 54 or 55 or 56 or 57 or 58 or 59
    ?: 60 or 61 or 62 or 63 or 64 or 65 or 66 - 67 or 68 or 69 or 70 or 1 + 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 + 19 -
        20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 || 42 or 43 or 44 or 45 or 46 or 47 &&
        48 or 49 ||
        50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or
            12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 or
            42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70)
}
>
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:80)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:44)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:38)
	at org.junit.jupiter.api.Assertions.assertAll(Assertions.java:2940)
	at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest.fixAndCompare(DiktatSmokeTest.kt:29)
	at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTestBase.fix can cause long line(DiktatSmokeTestBase.kt:316)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	Suppressed: org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
		at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
		at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
		at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
		at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
		at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:31)
		at org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:179)
		at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest.fixAndCompare$lambda$0(DiktatSmokeTest.kt:31)
		at org.junit.jupiter.api.AssertAll.lambda$assertAll$0(AssertAll.java:68)
		at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
		at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
		at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
		at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
		at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
		at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
		at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
		at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:77)
		... 8 more
	Suppressed: org.opentest4j.AssertionFailedError: expected: <package com.saveourtool.diktat

fun foo() {
    (1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31
    ?: 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 ?: 40 or 41 or 42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 + 54 or 55 or 56 or 57 or 58 or 59
    ?: 60 or 61 or 62 or 63 or 64 or 65 or 66 - 67 or 68 or 69 or 70 or 1 + 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 + 19 -
        20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 || 42 or 43 or 44 or 45 or 46 or 47 && 48 or 49 ||
        50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or
            12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 or
            42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70)
}
> but was: <package com.saveourtool.diktat

fun foo() {
    (1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31
    ?: 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 ?: 40 or 41 or 42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 + 54 or 55 or 56 or 57 or 58 or 59
    ?: 60 or 61 or 62 or 63 or 64 or 65 or 66 - 67 or 68 or 69 or 70 or 1 + 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 + 19 -
        20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 || 42 or 43 or 44 or 45 or 46 or 47 &&
        48 or 49 ||
        50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or
            12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 or
            42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70)
}
>
		at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
		at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
		at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
		at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
		at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
		at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1141)
		at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest.fixAndCompare$lambda$1(DiktatSmokeTest.kt:34)
		at org.junit.jupiter.api.AssertAll.lambda$assertAll$0(AssertAll.java:68)
		at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
		at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
		at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
		at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
		at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
		at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
		at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
		at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:77)
		... 8 more
Cause 1: org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:31)
	at org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:179)
	at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest.fixAndCompare$lambda$0(DiktatSmokeTest.kt:31)
	at org.junit.jupiter.api.AssertAll.lambda$assertAll$0(AssertAll.java:68)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:77)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:44)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:38)
	at org.junit.jupiter.api.Assertions.assertAll(Assertions.java:2940)
	at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest.fixAndCompare(DiktatSmokeTest.kt:29)
	at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTestBase.fix can cause long line(DiktatSmokeTestBase.kt:316)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
Cause 2: org.opentest4j.AssertionFailedError: expected: <package com.saveourtool.diktat

fun foo() {
    (1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31
    ?: 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 ?: 40 or 41 or 42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 + 54 or 55 or 56 or 57 or 58 or 59
    ?: 60 or 61 or 62 or 63 or 64 or 65 or 66 - 67 or 68 or 69 or 70 or 1 + 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 + 19 -
        20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 || 42 or 43 or 44 or 45 or 46 or 47 && 48 or 49 ||
        50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or
            12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 or
            42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70)
}
> but was: <package com.saveourtool.diktat

fun foo() {
    (1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31
    ?: 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 ?: 40 or 41 or 42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 + 54 or 55 or 56 or 57 or 58 or 59
    ?: 60 or 61 or 62 or 63 or 64 or 65 or 66 - 67 or 68 or 69 or 70 or 1 + 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 + 19 -
        20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 || 42 or 43 or 44 or 45 or 46 or 47 &&
        48 or 49 ||
        50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or
            12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 or
            42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70)
}
>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
	at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1141)
	at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest.fixAndCompare$lambda$1(DiktatSmokeTest.kt:34)
	at org.junit.jupiter.api.AssertAll.lambda$assertAll$0(AssertAll.java:68)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:77)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:44)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:38)
	at org.junit.jupiter.api.Assertions.assertAll(Assertions.java:2940)
	at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest.fixAndCompare(DiktatSmokeTest.kt:29)
	at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTestBase.fix can cause long line(DiktatSmokeTestBase.kt:316)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at java.util.ArrayList.forEach(ArrayList.java:1259)

Check failure on line 29 in diktat-ruleset/src/test/kotlin/com/saveourtool/diktat/ruleset/smoke/DiktatSmokeTest.kt

View workflow job for this annotation

GitHub Actions / JUnit Tests (Linux, dorny/test-reporter@v1)

com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest ► fix can cause long line()

Failed test found in: diktat-ruleset/build/test-results/test/TEST-com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest.xml Error: org.gradle.internal.exceptions.DefaultMultiCauseException: Multiple Failures (2 failures)
Raw output
org.gradle.internal.exceptions.DefaultMultiCauseException: Multiple Failures (2 failures)
	org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
	org.opentest4j.AssertionFailedError: expected: <package com.saveourtool.diktat

fun foo() {
    (1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31
    ?: 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 ?: 40 or 41 or 42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 + 54 or 55 or 56 or 57 or 58 or 59
    ?: 60 or 61 or 62 or 63 or 64 or 65 or 66 - 67 or 68 or 69 or 70 or 1 + 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 + 19 -
        20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 || 42 or 43 or 44 or 45 or 46 or 47 && 48 or 49 ||
        50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or
            12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 or
            42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70)
}
> but was: <package com.saveourtool.diktat

fun foo() {
    (1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31
    ?: 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 ?: 40 or 41 or 42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 + 54 or 55 or 56 or 57 or 58 or 59
    ?: 60 or 61 or 62 or 63 or 64 or 65 or 66 - 67 or 68 or 69 or 70 or 1 + 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 + 19 -
        20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 || 42 or 43 or 44 or 45 or 46 or 47 &&
        48 or 49 ||
        50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or
            12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 or
            42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70)
}
>
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:80)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:44)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:38)
	at org.junit.jupiter.api.Assertions.assertAll(Assertions.java:2940)
	at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest.fixAndCompare(DiktatSmokeTest.kt:29)
	at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTestBase.fix can cause long line(DiktatSmokeTestBase.kt:316)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	Suppressed: org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
		at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
		at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
		at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
		at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
		at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:31)
		at org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:179)
		at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest.fixAndCompare$lambda$0(DiktatSmokeTest.kt:31)
		at org.junit.jupiter.api.AssertAll.lambda$assertAll$0(AssertAll.java:68)
		at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
		at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
		at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
		at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
		at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
		at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
		at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
		at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:77)
		... 8 more
	Suppressed: org.opentest4j.AssertionFailedError: expected: <package com.saveourtool.diktat

fun foo() {
    (1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31
    ?: 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 ?: 40 or 41 or 42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 + 54 or 55 or 56 or 57 or 58 or 59
    ?: 60 or 61 or 62 or 63 or 64 or 65 or 66 - 67 or 68 or 69 or 70 or 1 + 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 + 19 -
        20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 || 42 or 43 or 44 or 45 or 46 or 47 && 48 or 49 ||
        50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or
            12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 or
            42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70)
}
> but was: <package com.saveourtool.diktat

fun foo() {
    (1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31
    ?: 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 ?: 40 or 41 or 42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 + 54 or 55 or 56 or 57 or 58 or 59
    ?: 60 or 61 or 62 or 63 or 64 or 65 or 66 - 67 or 68 or 69 or 70 or 1 + 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 + 19 -
        20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 || 42 or 43 or 44 or 45 or 46 or 47 &&
        48 or 49 ||
        50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or
            12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 or
            42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70)
}
>
		at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
		at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
		at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
		at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
		at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
		at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1141)
		at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest.fixAndCompare$lambda$1(DiktatSmokeTest.kt:34)
		at org.junit.jupiter.api.AssertAll.lambda$assertAll$0(AssertAll.java:68)
		at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
		at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
		at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
		at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
		at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
		at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
		at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
		at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:77)
		... 8 more
Cause 1: org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:31)
	at org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:179)
	at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest.fixAndCompare$lambda$0(DiktatSmokeTest.kt:31)
	at org.junit.jupiter.api.AssertAll.lambda$assertAll$0(AssertAll.java:68)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:77)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:44)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:38)
	at org.junit.jupiter.api.Assertions.assertAll(Assertions.java:2940)
	at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest.fixAndCompare(DiktatSmokeTest.kt:29)
	at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTestBase.fix can cause long line(DiktatSmokeTestBase.kt:316)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
Cause 2: org.opentest4j.AssertionFailedError: expected: <package com.saveourtool.diktat

fun foo() {
    (1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31
    ?: 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 ?: 40 or 41 or 42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 + 54 or 55 or 56 or 57 or 58 or 59
    ?: 60 or 61 or 62 or 63 or 64 or 65 or 66 - 67 or 68 or 69 or 70 or 1 + 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 + 19 -
        20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 || 42 or 43 or 44 or 45 or 46 or 47 && 48 or 49 ||
        50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or
            12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 or
            42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70)
}
> but was: <package com.saveourtool.diktat

fun foo() {
    (1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31
    ?: 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 ?: 40 or 41 or 42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 + 54 or 55 or 56 or 57 or 58 or 59
    ?: 60 or 61 or 62 or 63 or 64 or 65 or 66 - 67 or 68 or 69 or 70 or 1 + 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 + 19 -
        20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 || 42 or 43 or 44 or 45 or 46 or 47 &&
        48 or 49 ||
        50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or
            12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 or
            42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70)
}
>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
	at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1141)
	at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest.fixAndCompare$lambda$1(DiktatSmokeTest.kt:34)
	at org.junit.jupiter.api.AssertAll.lambda$assertAll$0(AssertAll.java:68)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:77)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:44)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:38)
	at org.junit.jupiter.api.Assertions.assertAll(Assertions.java:2940)
	at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest.fixAndCompare(DiktatSmokeTest.kt:29)
	at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTestBase.fix can cause long line(DiktatSmokeTestBase.kt:316)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at java.util.ArrayList.forEach(ArrayList.java:1259)

Check failure on line 29 in diktat-ruleset/src/test/kotlin/com/saveourtool/diktat/ruleset/smoke/DiktatSmokeTest.kt

View workflow job for this annotation

GitHub Actions / JUnit Tests (Windows, dorny/test-reporter@v1)

com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest ► fix can cause long line()

Failed test found in: diktat-ruleset/build/test-results/test/TEST-com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest.xml Error: org.gradle.internal.exceptions.DefaultMultiCauseException: Multiple Failures (2 failures)
Raw output
org.gradle.internal.exceptions.DefaultMultiCauseException: Multiple Failures (2 failures)
	org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
	org.opentest4j.AssertionFailedError: expected: <package com.saveourtool.diktat

fun foo() {
    (1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31
    ?: 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 ?: 40 or 41 or 42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 + 54 or 55 or 56 or 57 or 58 or 59
    ?: 60 or 61 or 62 or 63 or 64 or 65 or 66 - 67 or 68 or 69 or 70 or 1 + 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 + 19 -
        20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 || 42 or 43 or 44 or 45 or 46 or 47 && 48 or 49 ||
        50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or
            12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 or
            42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70)
}
> but was: <package com.saveourtool.diktat

fun foo() {
    (1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31
    ?: 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 ?: 40 or 41 or 42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 + 54 or 55 or 56 or 57 or 58 or 59
    ?: 60 or 61 or 62 or 63 or 64 or 65 or 66 - 67 or 68 or 69 or 70 or 1 + 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 + 19 -
        20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 || 42 or 43 or 44 or 45 or 46 or 47 &&
        48 or 49 ||
        50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or
            12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 or
            42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70)
}
>
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:80)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:44)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:38)
	at org.junit.jupiter.api.Assertions.assertAll(Assertions.java:2940)
	at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest.fixAndCompare(DiktatSmokeTest.kt:29)
	at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTestBase.fix can cause long line(DiktatSmokeTestBase.kt:316)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	Suppressed: org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
		at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
		at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
		at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
		at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
		at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:31)
		at org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:179)
		at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest.fixAndCompare$lambda$0(DiktatSmokeTest.kt:31)
		at org.junit.jupiter.api.AssertAll.lambda$assertAll$0(AssertAll.java:68)
		at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
		at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
		at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
		at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
		at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
		at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
		at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
		at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:77)
		... 8 more
	Suppressed: org.opentest4j.AssertionFailedError: expected: <package com.saveourtool.diktat

fun foo() {
    (1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31
    ?: 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 ?: 40 or 41 or 42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 + 54 or 55 or 56 or 57 or 58 or 59
    ?: 60 or 61 or 62 or 63 or 64 or 65 or 66 - 67 or 68 or 69 or 70 or 1 + 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 + 19 -
        20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 || 42 or 43 or 44 or 45 or 46 or 47 && 48 or 49 ||
        50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or
            12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 or
            42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70)
}
> but was: <package com.saveourtool.diktat

fun foo() {
    (1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31
    ?: 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 ?: 40 or 41 or 42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 + 54 or 55 or 56 or 57 or 58 or 59
    ?: 60 or 61 or 62 or 63 or 64 or 65 or 66 - 67 or 68 or 69 or 70 or 1 + 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 + 19 -
        20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 || 42 or 43 or 44 or 45 or 46 or 47 &&
        48 or 49 ||
        50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or
            12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 or
            42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70)
}
>
		at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
		at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
		at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
		at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
		at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
		at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1141)
		at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest.fixAndCompare$lambda$1(DiktatSmokeTest.kt:34)
		at org.junit.jupiter.api.AssertAll.lambda$assertAll$0(AssertAll.java:68)
		at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
		at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
		at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
		at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
		at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
		at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
		at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
		at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:77)
		... 8 more
Cause 1: org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:31)
	at org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:179)
	at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest.fixAndCompare$lambda$0(DiktatSmokeTest.kt:31)
	at org.junit.jupiter.api.AssertAll.lambda$assertAll$0(AssertAll.java:68)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:77)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:44)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:38)
	at org.junit.jupiter.api.Assertions.assertAll(Assertions.java:2940)
	at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest.fixAndCompare(DiktatSmokeTest.kt:29)
	at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTestBase.fix can cause long line(DiktatSmokeTestBase.kt:316)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
Cause 2: org.opentest4j.AssertionFailedError: expected: <package com.saveourtool.diktat

fun foo() {
    (1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31
    ?: 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 ?: 40 or 41 or 42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 + 54 or 55 or 56 or 57 or 58 or 59
    ?: 60 or 61 or 62 or 63 or 64 or 65 or 66 - 67 or 68 or 69 or 70 or 1 + 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 + 19 -
        20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 || 42 or 43 or 44 or 45 or 46 or 47 && 48 or 49 ||
        50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or
            12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 or
            42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70)
}
> but was: <package com.saveourtool.diktat

fun foo() {
    (1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31
    ?: 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 ?: 40 or 41 or 42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 + 54 or 55 or 56 or 57 or 58 or 59
    ?: 60 or 61 or 62 or 63 or 64 or 65 or 66 - 67 or 68 or 69 or 70 or 1 + 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 + 19 -
        20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 || 42 or 43 or 44 or 45 or 46 or 47 &&
        48 or 49 ||
        50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70 or 1 or 2 or 3 or 4 or 5 or 6 or 7 or 8 or 9 or 10 or 11 or
            12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 or 23 or 24 or 25 or 26 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 or 36 or 37 or 38 or 39 or 40 or 41 or
            42 or 43 or 44 or 45 or 46 or 47 or 48 or 49 or 50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 or 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70)
}
>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:177)
	at org.junit.jupiter.api.Assertions.assertEquals(Assertions.java:1141)
	at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest.fixAndCompare$lambda$1(DiktatSmokeTest.kt:34)
	at org.junit.jupiter.api.AssertAll.lambda$assertAll$0(AssertAll.java:68)
	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
	at java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:566)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:77)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:44)
	at org.junit.jupiter.api.AssertAll.assertAll(AssertAll.java:38)
	at org.junit.jupiter.api.Assertions.assertAll(Assertions.java:2940)
	at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTest.fixAndCompare(DiktatSmokeTest.kt:29)
	at com.saveourtool.diktat.ruleset.smoke.DiktatSmokeTestBase.fix can cause long line(DiktatSmokeTestBase.kt:316)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
	at java.util.ArrayList.forEach(ArrayList.java:1259)
{
Assertions.assertTrue(result.isSuccessful)
},
{
Assertions.assertEquals(result.expectedContentWithoutWarns, result.actualContent)
}
)

}

@BeforeEach
Expand All @@ -40,7 +47,7 @@
}

private fun getTestComparatorUnit(config: Path) = TestComparatorUnit(
resourceFilePath = RESOURCE_FILE_PATH,
resourceReader = { tempDir.resolve("src/main/kotlin").resolve(it) },
function = { testFile ->
format(
ruleSetSupplier = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,33 @@
import com.saveourtool.diktat.ruleset.utils.indentation.IndentationConfig.Companion.EXTENDED_INDENT_AFTER_OPERATORS
import com.saveourtool.diktat.ruleset.utils.indentation.IndentationConfig.Companion.EXTENDED_INDENT_BEFORE_DOT
import com.saveourtool.diktat.ruleset.utils.indentation.IndentationConfig.Companion.EXTENDED_INDENT_FOR_EXPRESSION_BODIES
import com.saveourtool.diktat.test.framework.util.deleteIfExistsSilently

import com.charleskorn.kaml.Yaml
import com.charleskorn.kaml.YamlConfiguration
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.AfterAll
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.BeforeAll
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Tag
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.Timeout
import java.io.File
import org.junit.jupiter.api.io.TempDir
import java.nio.file.Path
import java.nio.file.Paths

import java.time.LocalDate
import java.util.concurrent.TimeUnit.SECONDS
import kotlin.io.path.ExperimentalPathApi
import kotlin.io.path.PathWalkOption
import kotlin.io.path.copyTo
import kotlin.io.path.createDirectories
import kotlin.io.path.createTempFile
import kotlin.io.path.inputStream
import kotlin.io.path.isDirectory
import kotlin.io.path.moveTo
import kotlin.io.path.name
import kotlin.io.path.toPath
import kotlin.io.path.walk
import kotlin.io.path.writeText

import kotlinx.serialization.builtins.ListSerializer
Expand All @@ -70,7 +77,10 @@
* @param rulesToOverride
*/
@Suppress("UnsafeCallOnNullableType")
private fun prepareOverriddenRulesConfig(rulesToDisable: List<Warnings> = emptyList(), rulesToOverride: RuleToConfig = emptyMap()): Path {
private fun prepareOverriddenRulesConfig(
rulesToDisable: List<Warnings> = emptyList(),
rulesToOverride: RuleToConfig = emptyMap(),
): Path {
val rulesConfig = RulesConfigReader().read(Paths.get(DEFAULT_CONFIG_PATH).inputStream())!!
.toMutableList()
.also { rulesConfig ->
Expand Down Expand Up @@ -294,7 +304,6 @@
@Test
@Tag("DiktatRuleSetProvider")
@Timeout(TEST_TIMEOUT_SECONDS, unit = SECONDS)
@Disabled("https://github.com/saveourtool/diktat/issues/1737")
fun `fix can cause long line`() {
val configFilePath = prepareOverriddenRulesConfig(
rulesToDisable = emptyList(),
Expand Down Expand Up @@ -390,36 +399,41 @@

companion object {
private const val DEFAULT_CONFIG_PATH = "../diktat-analysis.yml"
const val RESOURCE_FILE_PATH = "test/smoke/src/main/kotlin"
private const val ROOT_RESOURCE_FILE_PATH = "test/smoke"
private const val RESOURCE_FILE_PATH = "$ROOT_RESOURCE_FILE_PATH/src/main/kotlin"
Fixed Show fixed Hide fixed
Fixed Show fixed Hide fixed
private const val TEST_TIMEOUT_SECONDS = 30L
private val tmpFiles: MutableList<File> = mutableListOf()

@JvmStatic
@TempDir
internal var tempDir: Path = Paths.get("/invalid")

@BeforeAll
@JvmStatic
@OptIn(ExperimentalPathApi::class)
@Suppress("AVOID_NULL_CHECKS")
internal fun createTmpFiles() {
listOf(
"$RESOURCE_FILE_PATH/../../../build.gradle.kts_" to "build.gradle.kts",
"$RESOURCE_FILE_PATH/Example1Test.kt" to "Example1-2Test.kt",
)
.map { (resource, targetFileName) ->
DiktatSmokeTestBase::class.java
.classLoader
.getResource(resource)!!
.toURI()
.let {
val tmpTestFile = File(it).parentFile.resolve(targetFileName)
File(it).copyTo(tmpTestFile, true)
}
.let { tmpFiles.add(it) }
val resourceFilePath = DiktatSmokeTestBase::class.java
.classLoader
.getResource(ROOT_RESOURCE_FILE_PATH)
.let { resource ->
requireNotNull(resource) {
"$ROOT_RESOURCE_FILE_PATH not found"
}
}
.toURI()
.toPath()
resourceFilePath.walk(PathWalkOption.INCLUDE_DIRECTORIES).forEach { file ->
if (file.isDirectory()) {
tempDir.resolve(resourceFilePath.relativize(file)).createDirectories()
} else {
val dest = tempDir.resolve(resourceFilePath.relativize(file))
file.copyTo(dest)
when (file.name) {
"build.gradle.kts_" -> dest.moveTo(dest.parent.resolve("build.gradle.kts"))
"Example1Test.kt" -> dest.copyTo(dest.parent.resolve("Example1-2Test.kt"))
}
}
}

@AfterAll
@JvmStatic
internal fun deleteTmpFiles() {
tmpFiles.forEach {
it.toPath().deleteIfExistsSilently()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* A base interface to read resources for testing purposes
*/
interface ResourceReader : Function1<String, Path?> {
fun interface ResourceReader : Function1<String, Path?> {
/**
* @param resourceName
* @return [Path] for provider [resourceName]
Expand Down Expand Up @@ -40,11 +40,11 @@
* @param replacements a map of replacements which will be applied to actual and expected content before comparing.
* @return Instance of [ResourceReader] with replacements of content
*/
fun withReplacements(
fun ResourceReader.withReplacements(
tempDir: Path,
replacements: Map<String, String>,
): ResourceReader = object : ResourceReader {
override fun invoke(resourceName: String): Path? = default.invoke(resourceName)
override fun invoke(resourceName: String): Path? = this@withReplacements.invoke(resourceName)
?.let { originalFile ->
tempDir.resolve(resourceName)
.also { resultFile ->
Expand All @@ -57,6 +57,16 @@
}
}

/**
* @param resourceFilePath a prefix for loading resources
* @return Instance of [ResourceReader] which loads resource with [resourceFilePath] as prefix
*/
fun ResourceReader.withPrefix(
resourceFilePath: String,
): ResourceReader = object : ResourceReader {
override fun invoke(resourceName: String): Path? = [email protected]("$resourceFilePath/$resourceName")
}
Fixed Show fixed Hide fixed

private fun String.replaceAll(replacements: Map<String, String>): String = replacements.entries
.fold(this) { result, replacement ->
result.replace(replacement.key, replacement.value)
Expand Down
Loading
Loading