From 2657efbd0b609856e335427514b03cc4bfa4e457 Mon Sep 17 00:00:00 2001 From: TrojanerHD Date: Tue, 29 Aug 2023 11:13:44 +0200 Subject: [PATCH 1/5] Upgrade dependencies, force trailing comma, upgrade gradle wrapper, force Java version 17 --- .editorconfig | 4 +- gradle/versions.gradle | 54 ++++---- gradle/wrapper/gradle-wrapper.properties | 2 +- .../de/smartsquare/squit/SquitPlugin.kt | 4 +- .../squit/config/ConfigExtensions.kt | 8 +- .../smartsquare/squit/config/TestIndexer.kt | 12 +- .../entity/SquitDatabaseConfiguration.kt | 2 +- .../smartsquare/squit/entity/SquitMetaInfo.kt | 6 +- .../squit/entity/SquitResponseInfo.kt | 4 +- .../smartsquare/squit/entity/SquitResult.kt | 2 +- .../squit/entity/SquitResultTree.kt | 6 +- .../de/smartsquare/squit/entity/SquitTest.kt | 8 +- .../squit/mediatype/BodyProcessor.kt | 4 +- .../squit/mediatype/MediaTypeConfig.kt | 2 +- .../mediatype/generic/GenericBodyProcessor.kt | 4 +- .../squit/mediatype/generic/GenericDiffer.kt | 2 +- .../squit/mediatype/json/JsonBodyProcessor.kt | 12 +- .../squit/mediatype/json/JsonDiffer.kt | 2 +- .../squit/mediatype/xml/XmlBodyProcessor.kt | 12 +- .../squit/mediatype/xml/XmlCanonicalizer.kt | 5 +- .../squit/report/HtmlReportWriter.kt | 32 +++-- .../squit/task/SquitPostProcessRunner.kt | 8 +- .../squit/task/SquitPostProcessTask.kt | 22 +-- .../squit/task/SquitPreProcessTask.kt | 7 +- .../squit/task/SquitRequestTask.kt | 28 ++-- .../smartsquare/squit/task/SquitTestTask.kt | 42 +++--- .../squit/GradleCompatibilityTest.kt | 12 +- .../kotlin/de/smartsquare/squit/TestUtils.kt | 2 +- .../squit/config/ConfigExtensionsTest.kt | 130 +++++++++--------- .../squit/config/TestIndexerTest.kt | 6 +- .../squit/entity/SquitResultTest.kt | 8 +- .../squit/entity/SquitResultTreeTest.kt | 6 +- .../smartsquare/squit/entity/SquitTestTest.kt | 14 +- .../mediatype/json/JsonCanonicalizerTest.kt | 12 +- .../mediatype/xml/XmlCanonicalizerTest.kt | 16 +-- .../task/SquitPostProcessTaskJsonTest.kt | 5 +- .../squit/task/SquitPostProcessTaskTest.kt | 19 ++- ...quitPreProcessTaskDifferentEncodingTest.kt | 6 +- .../squit/task/SquitPreProcessTaskGetTest.kt | 4 +- .../squit/task/SquitPreProcessTaskJsonTest.kt | 5 +- .../task/SquitPreProcessTaskOptionsTest.kt | 4 +- .../SquitPreProcessTaskPlaceholderTest.kt | 7 +- .../squit/task/SquitPreProcessTaskTest.kt | 31 +++-- .../squit/task/SquitRequestTaskGetTest.kt | 5 +- .../task/SquitRequestTaskInvalidSqlTest.kt | 5 +- .../squit/task/SquitRequestTaskJsonTest.kt | 7 +- .../squit/task/SquitRequestTaskOptionsTest.kt | 5 +- .../squit/task/SquitRequestTaskTest.kt | 28 ++-- .../SquitTestTaskDifferentStructureTest.kt | 5 +- .../SquitTestTaskErrorResponseCodeTest.kt | 10 +- .../task/SquitTestTaskIgnoreFailuresTest.kt | 5 +- .../SquitTestTaskJsonDifferentOrderTest.kt | 9 +- .../squit/task/SquitTestTaskJsonTest.kt | 5 +- .../SquitTestTaskNonStrictXmlDiffingTest.kt | 5 +- .../squit/task/SquitTestTaskTest.kt | 23 ++-- 55 files changed, 390 insertions(+), 303 deletions(-) diff --git a/.editorconfig b/.editorconfig index 713e7657..993c4821 100644 --- a/.editorconfig +++ b/.editorconfig @@ -7,8 +7,10 @@ max_line_length = 120 insert_final_newline = true trim_trailing_whitespace = true -[*.kt] +[*.{kt,kts}] continuation_indent_size = 4 +ij_kotlin_allow_trailing_comma = true +ij_kotlin_allow_trailing_comma_on_call_site = true [*.{java,gradle}] continuation_indent_size = 8 diff --git a/gradle/versions.gradle b/gradle/versions.gradle index 9317552c..eb969a38 100644 --- a/gradle/versions.gradle +++ b/gradle/versions.gradle @@ -1,44 +1,44 @@ ext { - javaVersion = JavaVersion.VERSION_1_8 - gradleVersion = '7.5.1' + javaVersion = JavaVersion.VERSION_17 + gradleVersion = '8.3' squitVersion = '5.1.0' - gradlePublishVersion = '1.1.0' + gradlePublishVersion = '1.2.1' - kotlinVersion = '1.7.21' - dokkaVersion = '1.7.20' + kotlinVersion = '1.9.10' + dokkaVersion = '1.8.20' - jacocoVersion = '0.8.8' - gradleVersionsVersion = '0.44.0' + jacocoVersion = '0.8.10' + gradleVersionsVersion = '0.47.0' gradleTestIdeaFixVersion = '0.1.0' - jaxenVersion = '1.2.0' - dom4jVersion = '2.1.3' + jaxenVersion = '2.0.0' + dom4jVersion = '2.1.4' pullParserVersion = '2.1.10' - gsonVersion = '2.10' - xmlSecVersion = '3.0.1' - xmlUnitVersion = '2.9.0' - jsonUnitVersion = '2.36.0' + gsonVersion = '2.10.1' + xmlSecVersion = '3.0.2' + xmlUnitVersion = '2.9.1' + jsonUnitVersion = '3.0.0' typesafeConfigVersion = '1.4.2' - okhttpVersion = '4.10.0' - kotlinHtmlVersion = '0.8.0' + okhttpVersion = '4.11.0' + kotlinHtmlVersion = '0.9.1' diffUtilsVersion = '3.0' alphanumericComparatorVersion = "1.4.1" - bootstrapVersion = '4.6.0' - jqueryVersion = '3.6.0' + bootstrapVersion = '5.3.1' + jqueryVersion = '3.7.0' popperVersion = '1.16.1' - fontAwesomeVersion = '5.15.4' - diff2htmlVersion = '3.1.7' - markedVersion = '2.0.6' + fontAwesomeVersion = '6.4.2' + diff2htmlVersion = '3.4.29' + markedVersion = '7.0.3' - detektVersion = '1.21.0' - ktlintPluginVersion = '11.0.0' + detektVersion = '1.23.1' + ktlintPluginVersion = '11.5.1' - junitVersion = '5.9.1' + junitVersion = '5.10.0' junitPlatformVersion = '1.7.2' - kluentVersion = '1.72' - h2Version = '2.1.214' - mockkVersion = '1.13.2' - byteBuddyVersion = '1.12.19' + kluentVersion = '1.73' + h2Version = '2.2.220' + mockkVersion = '1.13.7' + byteBuddyVersion = '1.14.7' } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index ae04661e..db9a6b82 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/kotlin/de/smartsquare/squit/SquitPlugin.kt b/src/main/kotlin/de/smartsquare/squit/SquitPlugin.kt index c6c3b30b..d61a3549 100644 --- a/src/main/kotlin/de/smartsquare/squit/SquitPlugin.kt +++ b/src/main/kotlin/de/smartsquare/squit/SquitPlugin.kt @@ -20,7 +20,7 @@ class SquitPlugin : Plugin { override fun apply(project: Project) { if (GradleVersion.current() < GradleVersion.version("6.8")) { throw GradleException( - "Minimum supported Gradle version is 6.8. Current version is ${GradleVersion.current().version}." + "Minimum supported Gradle version is 6.8. Current version is ${GradleVersion.current().version}.", ) } @@ -51,7 +51,7 @@ class SquitPlugin : Plugin { extension.xml.strict, extension.xml.canonicalize, extension.xml.resolveInvalidNamespaces, - extension.json.canonicalize + extension.json.canonicalize, ) it.dependsOn("squitPostProcess") diff --git a/src/main/kotlin/de/smartsquare/squit/config/ConfigExtensions.kt b/src/main/kotlin/de/smartsquare/squit/config/ConfigExtensions.kt index 34c00355..bc4d7548 100644 --- a/src/main/kotlin/de/smartsquare/squit/config/ConfigExtensions.kt +++ b/src/main/kotlin/de/smartsquare/squit/config/ConfigExtensions.kt @@ -138,7 +138,7 @@ val Config.databaseConfigurations it.getString(DATABASE_CONFIGURATION_NAME), it.getString(DATABASE_CONFIGURATION_JDBC_ADDRESS), it.getString(DATABASE_CONFIGURATION_USERNAME), - it.getString(DATABASE_CONFIGURATION_PASSWORD) + it.getString(DATABASE_CONFIGURATION_PASSWORD), ) } @@ -166,7 +166,7 @@ fun Config.mergeTag(tag: String): Config = withValue(TAGS, ConfigValueFactory.fr */ fun Config.withTestDir(testDir: Path): Config = withValue( TEST_DIRECTORY, - ConfigValueFactory.fromAnyRef(testDir.toString()) + ConfigValueFactory.fromAnyRef(testDir.toString()), ) /** @@ -204,7 +204,7 @@ fun Config.writeTo( options: ConfigRenderOptions = ConfigRenderOptions.defaults() .setComments(false) .setOriginComments(false) - .setJson(false) + .setJson(false), ): Path = Files.write(path, root().render(options).toByteArray()) private fun Config.getSafeBoolean(path: String, fallback: Boolean = false) = when (hasPath(path)) { @@ -219,7 +219,7 @@ private fun Config.getSafeString(path: String, fallback: String = "") = when (ha private fun Config.getSafeStringList( path: String, - fallback: List = emptyList() + fallback: List = emptyList(), ): List = when (hasPath(path)) { true -> getStringList(path) false -> fallback diff --git a/src/main/kotlin/de/smartsquare/squit/config/TestIndexer.kt b/src/main/kotlin/de/smartsquare/squit/config/TestIndexer.kt index f3a6f3d2..feb13975 100644 --- a/src/main/kotlin/de/smartsquare/squit/config/TestIndexer.kt +++ b/src/main/kotlin/de/smartsquare/squit/config/TestIndexer.kt @@ -43,13 +43,13 @@ class TestIndexer(private val projectConfig: Config) { private fun indexConfigs( leafDirectories: Sequence, sourceDir: Path, - filter: (Pair) -> Boolean + filter: (Pair) -> Boolean, ): List> { return leafDirectories .onEach { path -> if (path.cut(sourceDir).toList().size < 2) { throw GradleException( - "Invalid project structure. Please add a project directory to the src/squit directory." + "Invalid project structure. Please add a project directory to the src/squit directory.", ) } } @@ -72,7 +72,7 @@ class TestIndexer(private val projectConfig: Config) { |Invalid test.conf or local.conf file on path of test: | ${leafDirectory.cut(sourceDir)} ($innerMessage) """.trimMargin().replace("\n", ""), - error + error, ) } } @@ -81,7 +81,7 @@ class TestIndexer(private val projectConfig: Config) { private fun indexTests( leafDirectoriesWithConfig: List>, - sourceDir: Path + sourceDir: Path, ): List { return leafDirectoriesWithConfig .filterNot { (path, _) -> FilesUtils.isDirectoryEmpty(path) } @@ -169,7 +169,7 @@ class TestIndexer(private val projectConfig: Config) { private fun resolveResponse(path: Path, config: Config): Path { return FilesUtils.validateExistence( - path.resolve(MediaTypeFactory.sourceResponse(config.mediaType)) + path.resolve(MediaTypeFactory.sourceResponse(config.mediaType)), ) } @@ -177,7 +177,7 @@ class TestIndexer(private val projectConfig: Config) { path: Path, config: Config, leafs: List, - leafPath: Path + leafPath: Path, ): Map { return config.databaseConfigurations.associate { databaseConfig -> val pre = FilesUtils.ifExists(path.resolve("${databaseConfig.name}_pre.sql")) diff --git a/src/main/kotlin/de/smartsquare/squit/entity/SquitDatabaseConfiguration.kt b/src/main/kotlin/de/smartsquare/squit/entity/SquitDatabaseConfiguration.kt index 6bb127c2..98be586c 100644 --- a/src/main/kotlin/de/smartsquare/squit/entity/SquitDatabaseConfiguration.kt +++ b/src/main/kotlin/de/smartsquare/squit/entity/SquitDatabaseConfiguration.kt @@ -12,5 +12,5 @@ data class SquitDatabaseConfiguration( val name: String, val jdbcAddress: String, val username: String, - val password: String + val password: String, ) diff --git a/src/main/kotlin/de/smartsquare/squit/entity/SquitMetaInfo.kt b/src/main/kotlin/de/smartsquare/squit/entity/SquitMetaInfo.kt index 484d975f..1a00d4f1 100644 --- a/src/main/kotlin/de/smartsquare/squit/entity/SquitMetaInfo.kt +++ b/src/main/kotlin/de/smartsquare/squit/entity/SquitMetaInfo.kt @@ -25,7 +25,7 @@ data class SquitMetaInfo(val date: LocalDateTime, val duration: Long) { return SquitMetaInfo( LocalDateTime.parse(config.getString(DATE)), - config.getLong(DURATION) + config.getLong(DURATION), ) } } @@ -36,7 +36,7 @@ data class SquitMetaInfo(val date: LocalDateTime, val duration: Long) { fun toJson(): String = Gson().toJson( mapOf( DATE to date.toString(), - DURATION to duration - ) + DURATION to duration, + ), ) } diff --git a/src/main/kotlin/de/smartsquare/squit/entity/SquitResponseInfo.kt b/src/main/kotlin/de/smartsquare/squit/entity/SquitResponseInfo.kt index 339be919..c0464782 100644 --- a/src/main/kotlin/de/smartsquare/squit/entity/SquitResponseInfo.kt +++ b/src/main/kotlin/de/smartsquare/squit/entity/SquitResponseInfo.kt @@ -33,8 +33,8 @@ data class SquitResponseInfo(val responseCode: Int = 0) { */ fun toJson(): String = GsonBuilder().setPrettyPrinting().create().toJson( mapOf( - RESPONSE_CODE to responseCode - ) + RESPONSE_CODE to responseCode, + ), ) /** diff --git a/src/main/kotlin/de/smartsquare/squit/entity/SquitResult.kt b/src/main/kotlin/de/smartsquare/squit/entity/SquitResult.kt index 41e063b9..213c0c80 100644 --- a/src/main/kotlin/de/smartsquare/squit/entity/SquitResult.kt +++ b/src/main/kotlin/de/smartsquare/squit/entity/SquitResult.kt @@ -41,7 +41,7 @@ data class SquitResult( private val contextPath: Path, private val suitePath: Path, private val testDirectoryPath: Path, - private val squitBuildDirectoryPath: Path + private val squitBuildDirectoryPath: Path, ) { /** diff --git a/src/main/kotlin/de/smartsquare/squit/entity/SquitResultTree.kt b/src/main/kotlin/de/smartsquare/squit/entity/SquitResultTree.kt index 943da9a1..14ec1036 100644 --- a/src/main/kotlin/de/smartsquare/squit/entity/SquitResultTree.kt +++ b/src/main/kotlin/de/smartsquare/squit/entity/SquitResultTree.kt @@ -19,7 +19,7 @@ data class SquitResultTree( val name: String, val successfulTests: Int, val failedTests: Int, - val ignoredTests: Int + val ignoredTests: Int, ) { companion object { @@ -41,7 +41,7 @@ data class SquitResultTree( group.first().combinedName, successfulTests, failedTests, - ignoredTests + ignoredTests, ) } else { SquitResultTree( @@ -50,7 +50,7 @@ data class SquitResultTree( path.first().fileName.toString(), successfulTests, failedTests, - ignoredTests + ignoredTests, ) } } diff --git a/src/main/kotlin/de/smartsquare/squit/entity/SquitTest.kt b/src/main/kotlin/de/smartsquare/squit/entity/SquitTest.kt index d96776d5..785ce198 100644 --- a/src/main/kotlin/de/smartsquare/squit/entity/SquitTest.kt +++ b/src/main/kotlin/de/smartsquare/squit/entity/SquitTest.kt @@ -23,7 +23,7 @@ data class SquitTest( val response: Path, val preSqlScripts: Map>, val postSqlScripts: Map>, - val descriptions: List + val descriptions: List, ) : Serializable { private companion object { @@ -58,7 +58,7 @@ data class SquitTest( response.toString(), preSqlScripts.mapValues { (_, scripts) -> scripts.map { it.toString() } }, postSqlScripts.mapValues { (_, scripts) -> scripts.map { it.toString() } }, - descriptions.map { it.toString() } + descriptions.map { it.toString() }, ) } @@ -69,7 +69,7 @@ data class SquitTest( val response: String, val preSqlScripts: Map>, val postSqlScripts: Map>, - val descriptions: List + val descriptions: List, ) : Serializable { private companion object { @@ -84,7 +84,7 @@ data class SquitTest( Paths.get(response), preSqlScripts.mapValues { (_, scripts) -> scripts.map { Paths.get(it) } }, postSqlScripts.mapValues { (_, scripts) -> scripts.map { Paths.get(it) } }, - descriptions.map { Paths.get(it) } + descriptions.map { Paths.get(it) }, ) } } diff --git a/src/main/kotlin/de/smartsquare/squit/mediatype/BodyProcessor.kt b/src/main/kotlin/de/smartsquare/squit/mediatype/BodyProcessor.kt index 9d2e5cfd..6c8599f6 100644 --- a/src/main/kotlin/de/smartsquare/squit/mediatype/BodyProcessor.kt +++ b/src/main/kotlin/de/smartsquare/squit/mediatype/BodyProcessor.kt @@ -17,7 +17,7 @@ interface BodyProcessor { responsePath: Path, resultRequestPath: Path, resultResponsePath: Path, - config: Config + config: Config, ) /** @@ -28,6 +28,6 @@ interface BodyProcessor { actualResponsePath: Path, expectedResponsePath: Path, resultActualResponseFilePath: Path, - config: Config + config: Config, ) } diff --git a/src/main/kotlin/de/smartsquare/squit/mediatype/MediaTypeConfig.kt b/src/main/kotlin/de/smartsquare/squit/mediatype/MediaTypeConfig.kt index e97efef5..b20e8193 100644 --- a/src/main/kotlin/de/smartsquare/squit/mediatype/MediaTypeConfig.kt +++ b/src/main/kotlin/de/smartsquare/squit/mediatype/MediaTypeConfig.kt @@ -13,5 +13,5 @@ data class MediaTypeConfig( @get:Input val xmlStrict: Boolean = true, @get:Input val xmlCanonicalize: Boolean = true, @get:Input val resolveInvalidNamespaces: Boolean = false, - @get:Input val jsonCanonicalize: Boolean = true + @get:Input val jsonCanonicalize: Boolean = true, ) diff --git a/src/main/kotlin/de/smartsquare/squit/mediatype/generic/GenericBodyProcessor.kt b/src/main/kotlin/de/smartsquare/squit/mediatype/generic/GenericBodyProcessor.kt index 7c9dd73c..705a79a6 100644 --- a/src/main/kotlin/de/smartsquare/squit/mediatype/generic/GenericBodyProcessor.kt +++ b/src/main/kotlin/de/smartsquare/squit/mediatype/generic/GenericBodyProcessor.kt @@ -15,7 +15,7 @@ class GenericBodyProcessor : BodyProcessor { responsePath: Path, resultRequestPath: Path, resultResponsePath: Path, - config: Config + config: Config, ) { if (requestPath != null) Files.copy(requestPath, resultRequestPath) Files.copy(responsePath, resultResponsePath) @@ -25,7 +25,7 @@ class GenericBodyProcessor : BodyProcessor { actualResponsePath: Path, expectedResponsePath: Path, resultActualResponseFilePath: Path, - config: Config + config: Config, ) { Files.copy(actualResponsePath, resultActualResponseFilePath) } diff --git a/src/main/kotlin/de/smartsquare/squit/mediatype/generic/GenericDiffer.kt b/src/main/kotlin/de/smartsquare/squit/mediatype/generic/GenericDiffer.kt index c9c5e260..3cd4f3cc 100644 --- a/src/main/kotlin/de/smartsquare/squit/mediatype/generic/GenericDiffer.kt +++ b/src/main/kotlin/de/smartsquare/squit/mediatype/generic/GenericDiffer.kt @@ -13,7 +13,7 @@ class GenericDiffer : Differ { val diff = DiffUtils.diff( expectedResponse.toString(Charset.defaultCharset()), actualResponse.toString(Charset.defaultCharset()), - null + null, ) return diff.deltas.joinToString("\n") { diff --git a/src/main/kotlin/de/smartsquare/squit/mediatype/json/JsonBodyProcessor.kt b/src/main/kotlin/de/smartsquare/squit/mediatype/json/JsonBodyProcessor.kt index 380a3db5..e6b0a941 100644 --- a/src/main/kotlin/de/smartsquare/squit/mediatype/json/JsonBodyProcessor.kt +++ b/src/main/kotlin/de/smartsquare/squit/mediatype/json/JsonBodyProcessor.kt @@ -26,7 +26,7 @@ class JsonBodyProcessor : BodyProcessor { responsePath: Path, resultRequestPath: Path, resultResponsePath: Path, - config: Config + config: Config, ) { val request = requestPath?.let { JsonParserSupport.read(it) } val response = JsonParserSupport.read(responsePath) @@ -41,7 +41,7 @@ class JsonBodyProcessor : BodyProcessor { actualResponsePath: Path, expectedResponsePath: Path, resultActualResponseFilePath: Path, - config: Config + config: Config, ) { val actualResponse = JsonParserSupport.read(actualResponsePath) val expectedResponse = JsonParserSupport.read(expectedResponsePath) @@ -62,8 +62,8 @@ class JsonBodyProcessor : BodyProcessor { mapOf( "request" to request, "expectedResponse" to response, - "config" to config - ) + "config" to config, + ), ) }.run() } @@ -79,8 +79,8 @@ class JsonBodyProcessor : BodyProcessor { binding = Binding( mapOf( "actualResponse" to actualResponse, - "expectedResponse" to expectedResponse - ) + "expectedResponse" to expectedResponse, + ), ) }.run() } diff --git a/src/main/kotlin/de/smartsquare/squit/mediatype/json/JsonDiffer.kt b/src/main/kotlin/de/smartsquare/squit/mediatype/json/JsonDiffer.kt index 02ba4426..9683073d 100644 --- a/src/main/kotlin/de/smartsquare/squit/mediatype/json/JsonDiffer.kt +++ b/src/main/kotlin/de/smartsquare/squit/mediatype/json/JsonDiffer.kt @@ -12,7 +12,7 @@ class JsonDiffer : Differ { return try { JsonAssert.assertJsonEquals( expectedResponse.toString(Charsets.UTF_8), - actualResponse.toString(Charsets.UTF_8) + actualResponse.toString(Charsets.UTF_8), ) "" diff --git a/src/main/kotlin/de/smartsquare/squit/mediatype/xml/XmlBodyProcessor.kt b/src/main/kotlin/de/smartsquare/squit/mediatype/xml/XmlBodyProcessor.kt index 127c3066..c29c5621 100644 --- a/src/main/kotlin/de/smartsquare/squit/mediatype/xml/XmlBodyProcessor.kt +++ b/src/main/kotlin/de/smartsquare/squit/mediatype/xml/XmlBodyProcessor.kt @@ -26,7 +26,7 @@ class XmlBodyProcessor : BodyProcessor { responsePath: Path, resultRequestPath: Path, resultResponsePath: Path, - config: Config + config: Config, ) { val request = requestPath?.let { SAXReaderSupport.read(requestPath) } val response = SAXReaderSupport.read(responsePath) @@ -41,7 +41,7 @@ class XmlBodyProcessor : BodyProcessor { actualResponsePath: Path, expectedResponsePath: Path, resultActualResponseFilePath: Path, - config: Config + config: Config, ) { val actualResponse = SAXReaderSupport.read(actualResponsePath) val expectedResponse = SAXReaderSupport.read(expectedResponsePath) @@ -62,8 +62,8 @@ class XmlBodyProcessor : BodyProcessor { mapOf( "request" to request, "expectedResponse" to response, - "config" to config - ) + "config" to config, + ), ) }.run() } @@ -79,8 +79,8 @@ class XmlBodyProcessor : BodyProcessor { binding = Binding( mapOf( "actualResponse" to actualResponse, - "expectedResponse" to expectedResponse - ) + "expectedResponse" to expectedResponse, + ), ) }.run() } diff --git a/src/main/kotlin/de/smartsquare/squit/mediatype/xml/XmlCanonicalizer.kt b/src/main/kotlin/de/smartsquare/squit/mediatype/xml/XmlCanonicalizer.kt index bf1da6e7..11914413 100644 --- a/src/main/kotlin/de/smartsquare/squit/mediatype/xml/XmlCanonicalizer.kt +++ b/src/main/kotlin/de/smartsquare/squit/mediatype/xml/XmlCanonicalizer.kt @@ -35,10 +35,11 @@ class XmlCanonicalizer : Canonicalizer { return if (mediaTypeConfig.xmlCanonicalize) { val outputStream = ByteArrayOutputStream() - val content = if (mediaTypeConfig.resolveInvalidNamespaces) + val content = if (mediaTypeConfig.resolveInvalidNamespaces) { resolveInvalidNamespaces(input) - else + } else { input + } canonicalizer.canonicalize(content.toByteArray(), outputStream, false) diff --git a/src/main/kotlin/de/smartsquare/squit/report/HtmlReportWriter.kt b/src/main/kotlin/de/smartsquare/squit/report/HtmlReportWriter.kt index d30aa7ec..8dfb1866 100644 --- a/src/main/kotlin/de/smartsquare/squit/report/HtmlReportWriter.kt +++ b/src/main/kotlin/de/smartsquare/squit/report/HtmlReportWriter.kt @@ -25,12 +25,12 @@ class HtmlReportWriter(private val logger: Logger) { private const val DIFF_CONTEXT_SIZE = 1_000_000 private const val HTML_LINE_ENDING = "\\n\\\n" - private const val bootstrapPath = "META-INF/resources/webjars/bootstrap/4.6.0/dist" - private const val fontAwesomePath = "META-INF/resources/webjars/font-awesome/5.15.4" - private const val jqueryPath = "META-INF/resources/webjars/jquery/3.6.0/dist" + private const val bootstrapPath = "META-INF/resources/webjars/bootstrap/5.3.1/dist" + private const val fontAwesomePath = "META-INF/resources/webjars/font-awesome/6.4.2" + private const val jqueryPath = "META-INF/resources/webjars/jquery/3.7.0/dist" private const val popperJsPath = "META-INF/resources/webjars/popper.js/1.16.1/dist/umd" - private const val markedPath = "META-INF/resources/webjars/marked/2.0.6" - private const val diff2htmlPath = "META-INF/resources/webjars/diff2html/3.1.7" + private const val markedPath = "META-INF/resources/webjars/marked/7.0.3" + private const val diff2htmlPath = "META-INF/resources/webjars/diff2html/3.4.29" private val resources = arrayOf( "$bootstrapPath/css/bootstrap.min.css" to "css/bootstrap.css", @@ -43,7 +43,7 @@ class HtmlReportWriter(private val logger: Logger) { "$diff2htmlPath/bundles/js/diff2html.min.js" to "js/diff2html.js", "$diff2htmlPath/bundles/js/diff2html-ui.min.js" to "js/diff2html-ui.js", "squit.js" to "js/squit.js", - "squit.css" to "css/squit.css" + "squit.css" to "css/squit.css", ) private val emptyDiffHeader = listOf("--- $DIFF_FILE_NAME", "+++ $DIFF_FILE_NAME", "@@ -1 +1 @@") @@ -55,7 +55,7 @@ class HtmlReportWriter(private val logger: Logger) { fun writeReport( results: List, reportDirectoryPath: Path, - mediaTypeConfig: MediaTypeConfig + mediaTypeConfig: MediaTypeConfig, ) { val document = StringBuilder("").appendHTML().html { squitHead() @@ -78,8 +78,9 @@ class HtmlReportWriter(private val logger: Logger) { result.expectedLines, result.mediaType, mediaTypeConfig, - "Could not canonicalize expected response" + "Could not canonicalize expected response", ) + else -> result.expectedLines } @@ -88,8 +89,9 @@ class HtmlReportWriter(private val logger: Logger) { result.actualLines, result.mediaType, mediaTypeConfig, - "Could not canonicalize actual response" + "Could not canonicalize actual response", ) + else -> result.actualLines } @@ -98,8 +100,12 @@ class HtmlReportWriter(private val logger: Logger) { val unifiedDiffForJs = prepareForJs(bodyDiff) val unifiedInfoDiffForJs = prepareInfoForJs(result) - val descriptionForReplacement = if (result.description == null) "null" else "\"${result.description}\"" - .replace("\n", HTML_LINE_ENDING) + val descriptionForReplacement = if (result.description == null) { + "null" + } else { + "\"${result.description}\"" + .replace("\n", HTML_LINE_ENDING) + } Files.createDirectories(detailPath) Files.write(detailHtmlPath, detailDocument.toString().toByteArray()) @@ -153,7 +159,7 @@ class HtmlReportWriter(private val logger: Logger) { lines: List, mediaType: MediaType, mediaTypeConfig: MediaTypeConfig, - errorMessage: String + errorMessage: String, ): List { return when { lines.isEmpty() -> lines @@ -177,7 +183,7 @@ class HtmlReportWriter(private val logger: Logger) { filename, expectedLines, diff, - DIFF_CONTEXT_SIZE + DIFF_CONTEXT_SIZE, ) return when (unifiedDiff.isEmpty()) { diff --git a/src/main/kotlin/de/smartsquare/squit/task/SquitPostProcessRunner.kt b/src/main/kotlin/de/smartsquare/squit/task/SquitPostProcessRunner.kt index 238e472b..bbe9db7c 100644 --- a/src/main/kotlin/de/smartsquare/squit/task/SquitPostProcessRunner.kt +++ b/src/main/kotlin/de/smartsquare/squit/task/SquitPostProcessRunner.kt @@ -21,10 +21,10 @@ object SquitPostProcessRunner { processedSourcesPath: Path, actualResponsesPath: Path, processedActualResponsesPath: Path, - testPath: Path + testPath: Path, ) { val resultActualResponsePath = Files.createDirectories( - processedActualResponsesPath.resolve(testPath.cut(actualResponsesPath)) + processedActualResponsesPath.resolve(testPath.cut(actualResponsesPath)), ) val errorFile = testPath.resolve(Constants.ERROR) @@ -39,13 +39,13 @@ object SquitPostProcessRunner { val config = ConfigFactory.parseFile(configPath.toFile()) val actualResponsePath = FilesUtils.validateExistence( - testPath.resolve(MediaTypeFactory.actualResponse(config.mediaType)) + testPath.resolve(MediaTypeFactory.actualResponse(config.mediaType)), ) val expectedResponsePath = FilesUtils.validateExistence( processedSourcesPath .resolve(testPath.cut(actualResponsesPath)) - .resolve(MediaTypeFactory.expectedResponse(config.mediaType)) + .resolve(MediaTypeFactory.expectedResponse(config.mediaType)), ) val resultActualResponseFilePath = resultActualResponsePath diff --git a/src/main/kotlin/de/smartsquare/squit/task/SquitPostProcessTask.kt b/src/main/kotlin/de/smartsquare/squit/task/SquitPostProcessTask.kt index 0d5d80dd..67a75c41 100644 --- a/src/main/kotlin/de/smartsquare/squit/task/SquitPostProcessTask.kt +++ b/src/main/kotlin/de/smartsquare/squit/task/SquitPostProcessTask.kt @@ -40,9 +40,9 @@ open class SquitPostProcessTask @Inject constructor(private val workerExecutor: @InputDirectory @PathSensitive(PathSensitivity.RELATIVE) val processedSourcesPath: Path = Paths.get( - project.buildDir.path, + project.layout.buildDirectory.get().asFile.path, SQUIT_DIRECTORY, - SOURCES_DIRECTORY + SOURCES_DIRECTORY, ) /** @@ -50,10 +50,10 @@ open class SquitPostProcessTask @Inject constructor(private val workerExecutor: */ @Internal val actualResponsesPath: Path = Paths.get( - project.buildDir.path, + project.layout.buildDirectory.get().asFile.path, SQUIT_DIRECTORY, RESPONSES_DIRECTORY, - RAW_DIRECTORY + RAW_DIRECTORY, ) /** @@ -70,10 +70,10 @@ open class SquitPostProcessTask @Inject constructor(private val workerExecutor: */ @OutputDirectory val processedActualResponsesPath: Path = Paths.get( - project.buildDir.path, + project.layout.buildDirectory.get().asFile.path, SQUIT_DIRECTORY, RESPONSES_DIRECTORY, - PROCESSED_DIRECTORY + PROCESSED_DIRECTORY, ) init { @@ -103,7 +103,10 @@ open class SquitPostProcessTask @Inject constructor(private val workerExecutor: } else { FilesUtils.getLeafDirectories(actualResponsesPath, sort = false).forEach { testPath -> SquitPostProcessRunner.run( - processedSourcesPath, actualResponsesPath, processedActualResponsesPath, testPath + processedSourcesPath, + actualResponsesPath, + processedActualResponsesPath, + testPath, ) } } @@ -118,7 +121,10 @@ open class SquitPostProcessTask @Inject constructor(private val workerExecutor: override fun execute() { SquitPostProcessRunner.run( - processedSourcesPath, actualResponsesPath, processedActualResponsesPath, testPath + processedSourcesPath, + actualResponsesPath, + processedActualResponsesPath, + testPath, ) } } diff --git a/src/main/kotlin/de/smartsquare/squit/task/SquitPreProcessTask.kt b/src/main/kotlin/de/smartsquare/squit/task/SquitPreProcessTask.kt index cfc29468..37d7f5a3 100644 --- a/src/main/kotlin/de/smartsquare/squit/task/SquitPreProcessTask.kt +++ b/src/main/kotlin/de/smartsquare/squit/task/SquitPreProcessTask.kt @@ -47,7 +47,8 @@ open class SquitPreProcessTask @Inject constructor(private val workerExecutor: W * The directory to save the results in. */ @get:OutputDirectory - val processedSourcesPath: Path = Paths.get(project.buildDir.path, SQUIT_DIRECTORY, SOURCES_DIRECTORY) + val processedSourcesPath: Path = + Paths.get(project.layout.buildDirectory.get().asFile.path, SQUIT_DIRECTORY, SOURCES_DIRECTORY) /** * The tags to filter by (and). @@ -76,7 +77,7 @@ open class SquitPreProcessTask @Inject constructor(private val workerExecutor: W .fromMap( project.properties .filterKeys { it is String && it.startsWith("squit.") } - .mapKeys { (key, _) -> key.replaceFirst("squit.", "") } + .mapKeys { (key, _) -> key.replaceFirst("squit.", "") }, ) .toConfig() } @@ -133,11 +134,13 @@ open class SquitPreProcessTask @Inject constructor(private val workerExecutor: W false } + !isTestCoveredByTags(input.second) -> { logger.info("Ignoring test ${input.first.cut(sourceDir)}") false } + else -> true } diff --git a/src/main/kotlin/de/smartsquare/squit/task/SquitRequestTask.kt b/src/main/kotlin/de/smartsquare/squit/task/SquitRequestTask.kt index 60e99702..9a932d24 100644 --- a/src/main/kotlin/de/smartsquare/squit/task/SquitRequestTask.kt +++ b/src/main/kotlin/de/smartsquare/squit/task/SquitRequestTask.kt @@ -98,9 +98,9 @@ open class SquitRequestTask : DefaultTask() { */ @get:InputDirectory val processedSourcesPath: Path = Paths.get( - project.buildDir.path, + project.layout.buildDirectory.get().asFile.path, SQUIT_DIRECTORY, - SOURCES_DIRECTORY + SOURCES_DIRECTORY, ) /** @@ -108,10 +108,10 @@ open class SquitRequestTask : DefaultTask() { */ @get:OutputDirectory val actualResponsesPath: Path = Paths.get( - project.buildDir.path, + project.layout.buildDirectory.get().asFile.path, SQUIT_DIRECTORY, RESPONSES_DIRECTORY, - RAW_DIRECTORY + RAW_DIRECTORY, ) private val okHttpClient by lazy { @@ -150,12 +150,12 @@ open class SquitRequestTask : DefaultTask() { if (!silent) { logger.lifecycleOnSameLine( "Running test ${index + 1}", - project.gradle.startParameter.consoleOutput + project.gradle.startParameter.consoleOutput, ) } val resultResponsePath = Files.createDirectories( - actualResponsesPath.resolve(testDirectoryPath.cut(processedSourcesPath)) + actualResponsesPath.resolve(testDirectoryPath.cut(processedSourcesPath)), ) val errorFile = testDirectoryPath.resolve(ERROR) @@ -202,7 +202,7 @@ open class SquitRequestTask : DefaultTask() { testDirectoryPath: Path, resultResponsePath: Path, requestPath: Path?, - config: Config + config: Config, ) { val resultResponseFilePath = resultResponsePath.resolve(MediaTypeFactory.actualResponse(config.mediaType)) @@ -225,7 +225,7 @@ open class SquitRequestTask : DefaultTask() { logger.info( "Unsuccessful request for test ${testDirectoryPath.cut(processedSourcesPath)} " + - "(status code: ${apiResponse.code})" + "(status code: ${apiResponse.code})", ) } else if ( mediaType?.type != config.mediaType.type || @@ -235,7 +235,7 @@ open class SquitRequestTask : DefaultTask() { logger.info( "Unexpected Media type $mediaType for test ${testDirectoryPath.cut(processedSourcesPath)}. " + - "Expected ${config.mediaType}" + "Expected ${config.mediaType}", ) } } catch (error: IOException) { @@ -265,7 +265,7 @@ open class SquitRequestTask : DefaultTask() { testDirectoryPath.resolve("${it.name}_pre.sql"), it.jdbcAddress, it.username, - it.password + it.password, ) } } @@ -276,7 +276,7 @@ open class SquitRequestTask : DefaultTask() { testDirectoryPath.resolve("${it.name}_post.sql"), it.jdbcAddress, it.username, - it.password + it.password, ) } @@ -303,7 +303,7 @@ open class SquitRequestTask : DefaultTask() { .headers(config.headers.toHeaders()) .method(config.method, requestBody) .url(config.endpoint) - .build() + .build(), ) } @@ -311,7 +311,7 @@ open class SquitRequestTask : DefaultTask() { path: Path, jdbc: String, username: String, - password: String + password: String, ) = if (Files.exists(path)) { try { dbConnections.createOrGet(jdbc, username, password).executeScript(path) @@ -321,7 +321,7 @@ open class SquitRequestTask : DefaultTask() { logger.newLineIfNeeded() logger.warn( "Could not run database script ${path.fileName} for test " + - "${path.parent.cut(processedSourcesPath)} (${error.toString().trim()})" + "${path.parent.cut(processedSourcesPath)} (${error.toString().trim()})", ) false diff --git a/src/main/kotlin/de/smartsquare/squit/task/SquitTestTask.kt b/src/main/kotlin/de/smartsquare/squit/task/SquitTestTask.kt index 4e5ed426..fda42794 100644 --- a/src/main/kotlin/de/smartsquare/squit/task/SquitTestTask.kt +++ b/src/main/kotlin/de/smartsquare/squit/task/SquitTestTask.kt @@ -81,8 +81,9 @@ open class SquitTestTask : DefaultTask() { @get:InputDirectory @get:PathSensitive(PathSensitivity.RELATIVE) val processedSourcesPath: Path = Paths.get( - project.buildDir.path, - SQUIT_DIRECTORY, SOURCES_DIRECTORY + project.layout.buildDirectory.get().asFile.path, + SQUIT_DIRECTORY, + SOURCES_DIRECTORY, ) /** @@ -91,8 +92,10 @@ open class SquitTestTask : DefaultTask() { @get:InputDirectory @get:PathSensitive(PathSensitivity.RELATIVE) val processedResponsesPath: Path = Paths.get( - project.buildDir.path, - SQUIT_DIRECTORY, RESPONSES_DIRECTORY, PROCESSED_DIRECTORY + project.layout.buildDirectory.get().asFile.path, + SQUIT_DIRECTORY, + RESPONSES_DIRECTORY, + PROCESSED_DIRECTORY, ) /** @@ -103,7 +106,12 @@ open class SquitTestTask : DefaultTask() { @get:InputFiles @get:PathSensitive(PathSensitivity.RELATIVE) val metaPaths: List by lazy { - val rawDirectoryPath = Paths.get(project.buildDir.path, SQUIT_DIRECTORY, RESPONSES_DIRECTORY, RAW_DIRECTORY) + val rawDirectoryPath = Paths.get( + project.layout.buildDirectory.get().asFile.path, + SQUIT_DIRECTORY, + RESPONSES_DIRECTORY, + RAW_DIRECTORY, + ) if (Files.exists(rawDirectoryPath)) { Files.walk(rawDirectoryPath).use { stream -> @@ -180,7 +188,7 @@ open class SquitTestTask : DefaultTask() { FilesUtils.getLeafDirectories(processedResponsesPath).forEach { actualResponsePath -> val configPath = FilesUtils.validateExistence( - processedSourcesPath.resolve(actualResponsePath.cut(processedResponsesPath)).resolve(CONFIG) + processedSourcesPath.resolve(actualResponsePath.cut(processedResponsesPath)).resolve(CONFIG), ) val config = ConfigFactory.parseFile(configPath.toFile()) @@ -192,7 +200,9 @@ open class SquitTestTask : DefaultTask() { resultList += if (Files.exists(errorFile)) { constructResult( FilesUtils.readAllBytes(errorFile).toString(Charset.defaultCharset()), - expectedResponseInfo, actualResponsePath, config + expectedResponseInfo, + actualResponsePath, + config, ) } else { val bodyDiff = createBodyDifference(actualResponsePath, config) @@ -211,13 +221,13 @@ open class SquitTestTask : DefaultTask() { private fun createResponseInfoDifference( actualResponsePath: Path, - expectedResponseInfo: SquitResponseInfo + expectedResponseInfo: SquitResponseInfo, ): String { if (!expectedResponseInfo.isDefault) { val contextPath = actualResponsePath.parent.parent.cut(processedResponsesPath) val suitePath = actualResponsePath.parent.fileName val path: Path = contextPath.resolve(suitePath) - val squitBuildDirectoryPath = Paths.get(project.buildDir.path, SQUIT_DIRECTORY) + val squitBuildDirectoryPath = Paths.get(project.layout.buildDirectory.get().asFile.path, SQUIT_DIRECTORY) val testDirectoryPath = actualResponsePath.fileName val fullPath = path.resolve(testDirectoryPath) val resolvedPath = squitBuildDirectoryPath @@ -226,7 +236,7 @@ open class SquitTestTask : DefaultTask() { .resolve(fullPath) val actualResponseInfoPath = FilesUtils.validateExistence( - resolvedPath.resolve(ACTUAL_RESPONSE_INFO) + resolvedPath.resolve(ACTUAL_RESPONSE_INFO), ) val actualResponse = FilesUtils.readAllBytes(actualResponseInfoPath).toString(Charset.defaultCharset()) @@ -239,13 +249,13 @@ open class SquitTestTask : DefaultTask() { private fun createBodyDifference(actualResponsePath: Path, config: Config): String { val actualResponseFilePath = FilesUtils.validateExistence( - actualResponsePath.resolve(MediaTypeFactory.actualResponse(config.mediaType)) + actualResponsePath.resolve(MediaTypeFactory.actualResponse(config.mediaType)), ) val expectedResponseFilePath = FilesUtils.validateExistence( processedSourcesPath .resolve(actualResponsePath.cut(processedResponsesPath)) - .resolve(MediaTypeFactory.expectedResponse(config.mediaType)) + .resolve(MediaTypeFactory.expectedResponse(config.mediaType)), ) val expectedResponse = FilesUtils.readAllBytes(expectedResponseFilePath) @@ -289,9 +299,9 @@ open class SquitTestTask : DefaultTask() { responseInfo: SquitResponseInfo, actualResponsePath: Path, config: Config, - isIgnored: Boolean = false + isIgnored: Boolean = false, ): SquitResult { - val squitBuildDirectoryPath = Paths.get(project.buildDir.path, SQUIT_DIRECTORY) + val squitBuildDirectoryPath = Paths.get(project.layout.buildDirectory.get().asFile.path, SQUIT_DIRECTORY) val contextPath = actualResponsePath.parent.parent.cut(processedResponsesPath) val suitePath = actualResponsePath.parent.fileName val testDirectoryPath = actualResponsePath.fileName @@ -301,13 +311,13 @@ open class SquitTestTask : DefaultTask() { true -> SquitResult( id, differences, responseInfo, isIgnored, config.mediaType, config.title, contextPath, suitePath, - testDirectoryPath, squitBuildDirectoryPath + testDirectoryPath, squitBuildDirectoryPath, ) false -> SquitResult( id, "", responseInfo, isIgnored, config.mediaType, config.title, contextPath, suitePath, - testDirectoryPath, squitBuildDirectoryPath + testDirectoryPath, squitBuildDirectoryPath, ) } } diff --git a/src/test/kotlin/de/smartsquare/squit/GradleCompatibilityTest.kt b/src/test/kotlin/de/smartsquare/squit/GradleCompatibilityTest.kt index d8367ff3..24fcf82a 100644 --- a/src/test/kotlin/de/smartsquare/squit/GradleCompatibilityTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/GradleCompatibilityTest.kt @@ -24,20 +24,20 @@ class GradleCompatibilityTest { @JvmStatic fun provideVersions(): Stream { val result = mutableListOf( - Arguments.of(GradleVersion.current()) + Arguments.of(GradleVersion.current()), ) // These older Gradle Versions do not work on Java 17+. if (JavaVersion.current() <= JavaVersion.VERSION_16) { result += listOf( - Arguments.of(GradleVersion.version("7.0")) + Arguments.of(GradleVersion.version("7.0")), ) } // These older Gradle Versions do not work on Java 16+. if (JavaVersion.current() <= JavaVersion.VERSION_15) { result += listOf( - Arguments.of(GradleVersion.version("6.8")) + Arguments.of(GradleVersion.version("6.8")), ) } @@ -69,8 +69,10 @@ class GradleCompatibilityTest { server.enqueue(MockResponse().setBody("")) val arguments = listOf( - "squitTest", "-Psquit.endpointPlaceholder=${server.url("/")}", - "-Psquit.rootDir=$project", "--stacktrace" + "squitTest", + "-Psquit.endpointPlaceholder=${server.url("/")}", + "-Psquit.rootDir=$project", + "--stacktrace", ) val result = gradleRunner(project, arguments, gradleVersion).build() diff --git a/src/test/kotlin/de/smartsquare/squit/TestUtils.kt b/src/test/kotlin/de/smartsquare/squit/TestUtils.kt index e1fa7c24..4c5207ec 100644 --- a/src/test/kotlin/de/smartsquare/squit/TestUtils.kt +++ b/src/test/kotlin/de/smartsquare/squit/TestUtils.kt @@ -52,7 +52,7 @@ fun GradleRunner.withJacoco(): GradleRunner { Files.copy( File(properties.toURI()).toPath(), projectDir.toPath().resolve("gradle.properties"), - StandardCopyOption.REPLACE_EXISTING + StandardCopyOption.REPLACE_EXISTING, ) } diff --git a/src/test/kotlin/de/smartsquare/squit/config/ConfigExtensionsTest.kt b/src/test/kotlin/de/smartsquare/squit/config/ConfigExtensionsTest.kt index 6c589428..1d35b0b6 100644 --- a/src/test/kotlin/de/smartsquare/squit/config/ConfigExtensionsTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/config/ConfigExtensionsTest.kt @@ -69,8 +69,8 @@ class ConfigExtensionsTest { val config = ConfigFactory.parseMap( mapOf( "endpoint" to "https://example.com", - "method" to "GET" - ) + "method" to "GET", + ), ) config.method shouldBeEqualTo "GET" @@ -88,8 +88,8 @@ class ConfigExtensionsTest { val config = ConfigFactory.parseMap( mapOf( "endpoint" to "https://example.com", - "testDir" to Paths.get(".").toString() - ) + "testDir" to Paths.get(".").toString(), + ), ) val call = { config.validate() } @@ -102,8 +102,8 @@ class ConfigExtensionsTest { val config = ConfigFactory.parseMap( mapOf( "endpoint" to "https://example.com", - "testDir" to Paths.get("does_not_exist").toString() - ) + "testDir" to Paths.get("does_not_exist").toString(), + ), ) val call = { config.validate() } @@ -116,8 +116,8 @@ class ConfigExtensionsTest { val config = ConfigFactory.parseMap( mapOf( "endpoint" to "https://example.com", - "preProcessors" to listOf("java.lang.String") - ) + "preProcessors" to listOf("java.lang.String"), + ), ) val call = { config.validate() } @@ -130,8 +130,8 @@ class ConfigExtensionsTest { val config = ConfigFactory.parseMap( mapOf( "endpoint" to "https://example.com", - "preProcessors" to listOf("not.existing") - ) + "preProcessors" to listOf("not.existing"), + ), ) val call = { config.validate() } @@ -144,8 +144,8 @@ class ConfigExtensionsTest { val config = ConfigFactory.parseMap( mapOf( "endpoint" to "https://example.com", - "preProcessorScripts" to listOf(testProject.resolve("build.gradle").toString()) - ) + "preProcessorScripts" to listOf(testProject.resolve("build.gradle").toString()), + ), ) val call = { config.validate() } @@ -159,8 +159,8 @@ class ConfigExtensionsTest { val config = ConfigFactory.parseMap( mapOf( "endpoint" to "https://example.com", - "preProcessorScripts" to listOf(notExistingFilePath.toString()) - ) + "preProcessorScripts" to listOf(notExistingFilePath.toString()), + ), ) val call = { config.validate() } @@ -173,8 +173,8 @@ class ConfigExtensionsTest { val config = ConfigFactory.parseMap( mapOf( "endpoint" to "https://example.com", - "postProcessors" to listOf("java.lang.String") - ) + "postProcessors" to listOf("java.lang.String"), + ), ) val call = { config.validate() } @@ -187,8 +187,8 @@ class ConfigExtensionsTest { val config = ConfigFactory.parseMap( mapOf( "endpoint" to "https://example.com", - "postProcessors" to listOf("not.existing") - ) + "postProcessors" to listOf("not.existing"), + ), ) val call = { config.validate() } @@ -201,8 +201,8 @@ class ConfigExtensionsTest { val config = ConfigFactory.parseMap( mapOf( "endpoint" to "https://example.com", - "postProcessorScripts" to listOf(testProject.resolve("build.gradle").toString()) - ) + "postProcessorScripts" to listOf(testProject.resolve("build.gradle").toString()), + ), ) val call = { config.validate() } @@ -216,8 +216,8 @@ class ConfigExtensionsTest { val config = ConfigFactory.parseMap( mapOf( "endpoint" to "https://example.com", - "postProcessorScripts" to listOf(notExistingFilePath.toString()) - ) + "postProcessorScripts" to listOf(notExistingFilePath.toString()), + ), ) val call = { config.validate() } @@ -230,8 +230,8 @@ class ConfigExtensionsTest { val config = ConfigFactory.parseMap( mapOf( "endpoint" to "https://example.com", - "preRunners" to listOf("java.lang.String") - ) + "preRunners" to listOf("java.lang.String"), + ), ) val call = { config.validate() } @@ -244,8 +244,8 @@ class ConfigExtensionsTest { val config = ConfigFactory.parseMap( mapOf( "endpoint" to "https://example.com", - "preRunners" to listOf("not.existing") - ) + "preRunners" to listOf("not.existing"), + ), ) val call = { config.validate() } @@ -258,8 +258,8 @@ class ConfigExtensionsTest { val config = ConfigFactory.parseMap( mapOf( "endpoint" to "https://example.com", - "preRunnerScripts" to listOf(testProject.resolve("build.gradle").toString()) - ) + "preRunnerScripts" to listOf(testProject.resolve("build.gradle").toString()), + ), ) val call = { config.validate() } @@ -273,8 +273,8 @@ class ConfigExtensionsTest { val config = ConfigFactory.parseMap( mapOf( "endpoint" to "https://example.com", - "preRunnerScripts" to listOf(notExistingFilePath.toString()) - ) + "preRunnerScripts" to listOf(notExistingFilePath.toString()), + ), ) val call = { config.validate() } @@ -287,8 +287,8 @@ class ConfigExtensionsTest { val config = ConfigFactory.parseMap( mapOf( "endpoint" to "https://example.com", - "postRunners" to listOf("java.lang.String") - ) + "postRunners" to listOf("java.lang.String"), + ), ) val call = { config.validate() } @@ -301,8 +301,8 @@ class ConfigExtensionsTest { val config = ConfigFactory.parseMap( mapOf( "endpoint" to "https://example.com", - "postRunners" to listOf("not.existing") - ) + "postRunners" to listOf("not.existing"), + ), ) val call = { config.validate() } @@ -315,8 +315,8 @@ class ConfigExtensionsTest { val config = ConfigFactory.parseMap( mapOf( "endpoint" to "https://example.com", - "postRunnerScripts" to listOf(testProject.resolve("build.gradle").toString()) - ) + "postRunnerScripts" to listOf(testProject.resolve("build.gradle").toString()), + ), ) val call = { config.validate() } @@ -330,8 +330,8 @@ class ConfigExtensionsTest { val config = ConfigFactory.parseMap( mapOf( "endpoint" to "https://example.com", - "postRunnerScripts" to listOf(notExistingFilePath.toString()) - ) + "postRunnerScripts" to listOf(notExistingFilePath.toString()), + ), ) val call = { config.validate() } @@ -344,8 +344,8 @@ class ConfigExtensionsTest { val config = ConfigFactory.parseMap( mapOf( "endpoint" to "https://example.com", - "tags" to listOf("a", "b") - ) + "tags" to listOf("a", "b"), + ), ) val call = { config.validate() } @@ -358,8 +358,8 @@ class ConfigExtensionsTest { val config = ConfigFactory.parseMap( mapOf( "endpoint" to "https://example.com", - "tags" to listOf("a", "") - ) + "tags" to listOf("a", ""), + ), ) val call = { config.validate() } @@ -377,10 +377,10 @@ class ConfigExtensionsTest { "name" to "test1", "jdbc" to "test2", "username" to "test3", - "password" to "test4" - ) - ) - ) + "password" to "test4", + ), + ), + ), ) val call = { config.validate() } @@ -398,10 +398,10 @@ class ConfigExtensionsTest { "name" to "", "jdbc" to "test2", "username" to "test3", - "password" to "test4" - ) - ) - ) + "password" to "test4", + ), + ), + ), ) val call = { config.validate() } @@ -419,10 +419,10 @@ class ConfigExtensionsTest { "name" to "test1", "jdbc" to "", "username" to "test3", - "password" to "test4" - ) - ) - ) + "password" to "test4", + ), + ), + ), ) val call = { config.validate() } @@ -440,10 +440,10 @@ class ConfigExtensionsTest { "name" to "test1", "jdbc" to "test2", "username" to "", - "password" to "test4" - ) - ) - ) + "password" to "test4", + ), + ), + ), ) val call = { config.validate() } @@ -461,10 +461,10 @@ class ConfigExtensionsTest { "name" to "test1", "jdbc" to "test2", "username" to "test3", - "password" to "" - ) - ) - ) + "password" to "", + ), + ), + ), ) val call = { config.validate() } @@ -479,9 +479,9 @@ class ConfigExtensionsTest { "endpoint" to "https://example.com", "headers" to mapOf( "abc" to "def", - "ghi" to "jkl" - ) - ) + "ghi" to "jkl", + ), + ), ) config.headers shouldContain ("abc" to "def") diff --git a/src/test/kotlin/de/smartsquare/squit/config/TestIndexerTest.kt b/src/test/kotlin/de/smartsquare/squit/config/TestIndexerTest.kt index bbd0deb5..cce88552 100644 --- a/src/test/kotlin/de/smartsquare/squit/config/TestIndexerTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/config/TestIndexerTest.kt @@ -19,9 +19,9 @@ class TestIndexerTest { ConfigFactory.parseMap( mapOf( "rootDir" to "$testProjectRoot", - "endpointPlaceholder" to "https://example.com" - ) - ) + "endpointPlaceholder" to "https://example.com", + ), + ), ) @Test diff --git a/src/test/kotlin/de/smartsquare/squit/entity/SquitResultTest.kt b/src/test/kotlin/de/smartsquare/squit/entity/SquitResultTest.kt index afa34a0b..cc0252a5 100644 --- a/src/test/kotlin/de/smartsquare/squit/entity/SquitResultTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/entity/SquitResultTest.kt @@ -13,7 +13,7 @@ class SquitResultTest { fun `cutting the first path element of result with full path`() { val subject = SquitResult( 0, "", SquitResponseInfo(), false, mediaType, "", - Paths.get("a"), Paths.get("b"), Paths.get("c"), Paths.get("x") + Paths.get("a"), Paths.get("b"), Paths.get("c"), Paths.get("x"), ) val result = subject.cutFirstPathElement() @@ -25,7 +25,7 @@ class SquitResultTest { fun `cutting the first path element of a result without context path`() { val subject = SquitResult( 0, "", SquitResponseInfo(), false, mediaType, "", - Paths.get(""), Paths.get("b"), Paths.get("c"), Paths.get("x") + Paths.get(""), Paths.get("b"), Paths.get("c"), Paths.get("x"), ) val result = subject.cutFirstPathElement() @@ -37,7 +37,7 @@ class SquitResultTest { fun `cutting the first path element of a result with only testDirectoryPath`() { val subject = SquitResult( 0, "", SquitResponseInfo(), false, mediaType, "", - Paths.get(""), Paths.get(""), Paths.get("c"), Paths.get("x") + Paths.get(""), Paths.get(""), Paths.get("c"), Paths.get("x"), ) val result = subject.cutFirstPathElement() @@ -49,7 +49,7 @@ class SquitResultTest { fun `cutting the first path element of a result with empty path`() { val subject = SquitResult( 0, "", SquitResponseInfo(), false, mediaType, "", - Paths.get(""), Paths.get(""), Paths.get(""), Paths.get("x") + Paths.get(""), Paths.get(""), Paths.get(""), Paths.get("x"), ) val result = subject.cutFirstPathElement() diff --git a/src/test/kotlin/de/smartsquare/squit/entity/SquitResultTreeTest.kt b/src/test/kotlin/de/smartsquare/squit/entity/SquitResultTreeTest.kt index 5b531c1c..9584ebb7 100644 --- a/src/test/kotlin/de/smartsquare/squit/entity/SquitResultTreeTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/entity/SquitResultTreeTest.kt @@ -19,7 +19,7 @@ class SquitResultTreeTest { constructTestSquitResult(Paths.get("a"), Paths.get("b"), Paths.get("c").resolve("c")), constructTestSquitResult(Paths.get("a"), Paths.get("b"), Paths.get("d"), isIgnored = true), constructTestSquitResult(Paths.get("a"), Paths.get("c"), Paths.get(""), result = "xyz"), - constructTestSquitResult(Paths.get("x"), Paths.get("y").resolve("z"), Paths.get("x")) + constructTestSquitResult(Paths.get("x"), Paths.get("y").resolve("z"), Paths.get("x")), ) val resultTrees = SquitResultTree.fromList(resultList) @@ -45,9 +45,9 @@ class SquitResultTreeTest { testDirectoryPath: Path, mediaType: MediaType = "application/xml".toMediaType(), result: String = "", - isIgnored: Boolean = false + isIgnored: Boolean = false, ) = SquitResult( 0, result, SquitResponseInfo(), isIgnored, mediaType, "", - contextPath, suitePath, testDirectoryPath, Paths.get("") + contextPath, suitePath, testDirectoryPath, Paths.get(""), ) } diff --git a/src/test/kotlin/de/smartsquare/squit/entity/SquitTestTest.kt b/src/test/kotlin/de/smartsquare/squit/entity/SquitTestTest.kt index 6d20718c..6dd1c066 100644 --- a/src/test/kotlin/de/smartsquare/squit/entity/SquitTestTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/entity/SquitTestTest.kt @@ -21,7 +21,7 @@ class SquitTestTest { Paths.get("/response"), mapOf("test1_pre.sql" to listOf(Paths.get("/pre/test1_pre.sql"))), mapOf("test1_post.sql" to listOf(Paths.get("/post/test1_post.sql"))), - listOf(Paths.get("/test1/description.md")) + listOf(Paths.get("/test1/description.md")), ) val test2 = SquitTest( @@ -31,10 +31,10 @@ class SquitTestTest { Paths.get("/response"), mapOf( "test2_pre.sql" to listOf(Paths.get("/pre/test2_pre.sql")), - "test1_pre.sql" to listOf(Paths.get("/additional/test1_pre.sql")) + "test1_pre.sql" to listOf(Paths.get("/additional/test1_pre.sql")), ), mapOf("test2_post.sql" to listOf(Paths.get("/post/test2_post.sql"))), - listOf(Paths.get("/test2/description.md")) + listOf(Paths.get("/test2/description.md")), ) val expected = SquitTest( @@ -44,13 +44,13 @@ class SquitTestTest { Paths.get("/response"), mapOf( "test1_pre.sql" to listOf(Paths.get("/additional/test1_pre.sql"), Paths.get("/pre/test1_pre.sql")), - "test2_pre.sql" to listOf(Paths.get("/pre/test2_pre.sql")) + "test2_pre.sql" to listOf(Paths.get("/pre/test2_pre.sql")), ), mapOf( "test1_post.sql" to listOf(Paths.get("/post/test1_post.sql")), - "test2_post.sql" to listOf(Paths.get("/post/test2_post.sql")) + "test2_post.sql" to listOf(Paths.get("/post/test2_post.sql")), ), - listOf(Paths.get("/test2/description.md"), Paths.get("/test1/description.md")) + listOf(Paths.get("/test2/description.md"), Paths.get("/test1/description.md")), ) test1.merge(test2) shouldBeEqualTo expected @@ -65,7 +65,7 @@ class SquitTestTest { Paths.get("/response.xml"), mapOf("test_pre.sql" to listOf(Paths.get("/pre/test_pre.sql"))), mapOf("test_post.sql" to listOf(Paths.get("/post/test_pre.sql"))), - listOf(Paths.get("/description/description.md")) + listOf(Paths.get("/description/description.md")), ) val serialized = ByteArrayOutputStream().let { byteOut -> diff --git a/src/test/kotlin/de/smartsquare/squit/mediatype/json/JsonCanonicalizerTest.kt b/src/test/kotlin/de/smartsquare/squit/mediatype/json/JsonCanonicalizerTest.kt index 481262ea..c2de6696 100644 --- a/src/test/kotlin/de/smartsquare/squit/mediatype/json/JsonCanonicalizerTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/mediatype/json/JsonCanonicalizerTest.kt @@ -32,8 +32,8 @@ class JsonCanonicalizerTest { MediaTypeConfig( xmlStrict = false, xmlCanonicalize = false, - jsonCanonicalize = true - ) + jsonCanonicalize = true, + ), ) // language=json @@ -86,8 +86,8 @@ class JsonCanonicalizerTest { MediaTypeConfig( xmlStrict = false, xmlCanonicalize = false, - jsonCanonicalize = true - ) + jsonCanonicalize = true, + ), ) // language=json @@ -135,8 +135,8 @@ class JsonCanonicalizerTest { MediaTypeConfig( xmlStrict = false, xmlCanonicalize = false, - jsonCanonicalize = false - ) + jsonCanonicalize = false, + ), ) result shouldBeEqualTo structure diff --git a/src/test/kotlin/de/smartsquare/squit/mediatype/xml/XmlCanonicalizerTest.kt b/src/test/kotlin/de/smartsquare/squit/mediatype/xml/XmlCanonicalizerTest.kt index 290a7ad9..cf27a2a5 100644 --- a/src/test/kotlin/de/smartsquare/squit/mediatype/xml/XmlCanonicalizerTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/mediatype/xml/XmlCanonicalizerTest.kt @@ -22,8 +22,8 @@ class XmlCanonicalizerTest { MediaTypeConfig( xmlStrict = false, xmlCanonicalize = true, - jsonCanonicalize = false - ) + jsonCanonicalize = false, + ), ) // language=xml @@ -54,8 +54,8 @@ class XmlCanonicalizerTest { MediaTypeConfig( xmlStrict = false, xmlCanonicalize = false, - jsonCanonicalize = false - ) + jsonCanonicalize = false, + ), ) result shouldBeEqualTo structure @@ -76,8 +76,8 @@ class XmlCanonicalizerTest { xmlStrict = false, xmlCanonicalize = true, jsonCanonicalize = false, - resolveInvalidNamespaces = true - ) + resolveInvalidNamespaces = true, + ), ) // language=xml @@ -108,8 +108,8 @@ class XmlCanonicalizerTest { xmlStrict = false, xmlCanonicalize = true, jsonCanonicalize = false, - resolveInvalidNamespaces = true - ) + resolveInvalidNamespaces = true, + ), ) // language=xml diff --git a/src/test/kotlin/de/smartsquare/squit/task/SquitPostProcessTaskJsonTest.kt b/src/test/kotlin/de/smartsquare/squit/task/SquitPostProcessTaskJsonTest.kt index 04acd5d8..ffc79f35 100644 --- a/src/test/kotlin/de/smartsquare/squit/task/SquitPostProcessTaskJsonTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/task/SquitPostProcessTaskJsonTest.kt @@ -38,8 +38,9 @@ class SquitPostProcessTaskJsonTest { server.enqueue(MockResponse().setBody("{\n \"cool\": true\n}")) val arguments = listOf( - "squitPostProcess", "-Psquit.endpointPlaceholder=${server.url("/")}", - "-Psquit.rootDir=$jsonProject" + "squitPostProcess", + "-Psquit.endpointPlaceholder=${server.url("/")}", + "-Psquit.rootDir=$jsonProject", ) val result = gradleRunner(jsonProject, arguments).build() diff --git a/src/test/kotlin/de/smartsquare/squit/task/SquitPostProcessTaskTest.kt b/src/test/kotlin/de/smartsquare/squit/task/SquitPostProcessTaskTest.kt index 2276303a..50480a0c 100644 --- a/src/test/kotlin/de/smartsquare/squit/task/SquitPostProcessTaskTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/task/SquitPostProcessTaskTest.kt @@ -43,8 +43,10 @@ class SquitPostProcessTaskTest { server.enqueue(MockResponse().setBody("")) val arguments = listOf( - "squitPostProcess", "-Psquit.endpointPlaceholder=${server.url("/")}", - "-Psquit.rootDir=$project", "-PtagsOr=call1,call2" + "squitPostProcess", + "-Psquit.endpointPlaceholder=${server.url("/")}", + "-Psquit.rootDir=$project", + "-PtagsOr=call1,call2", ) val result = gradleRunner(project, arguments).build() @@ -63,8 +65,10 @@ class SquitPostProcessTaskTest { server.enqueue(MockResponse().setBody("")) val arguments = listOf( - "squitPostProcess", "-Psquit.endpointPlaceholder=${server.url("/")}", - "-Psquit.rootDir=$project", "-PtagsOr=call1,call2" + "squitPostProcess", + "-Psquit.endpointPlaceholder=${server.url("/")}", + "-Psquit.rootDir=$project", + "-PtagsOr=call1,call2", ) val result = gradleRunner(project, arguments).build() @@ -83,8 +87,11 @@ class SquitPostProcessTaskTest { } val arguments = listOf( - "squitPostProcess", "-Psquit.endpointPlaceholder=${server.url("/")}", - "-Psquit.rootDir=$project", "-PtagsOr=call1,call2", "--build-cache" + "squitPostProcess", + "-Psquit.endpointPlaceholder=${server.url("/")}", + "-Psquit.rootDir=$project", + "-PtagsOr=call1,call2", + "--build-cache", ) val result = gradleRunner(project, arguments).build() diff --git a/src/test/kotlin/de/smartsquare/squit/task/SquitPreProcessTaskDifferentEncodingTest.kt b/src/test/kotlin/de/smartsquare/squit/task/SquitPreProcessTaskDifferentEncodingTest.kt index e80892d9..d874572b 100644 --- a/src/test/kotlin/de/smartsquare/squit/task/SquitPreProcessTaskDifferentEncodingTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/task/SquitPreProcessTaskDifferentEncodingTest.kt @@ -32,8 +32,10 @@ class SquitPreProcessTaskDifferentEncodingTest { @Test fun `normal run`() { val arguments = listOf( - "squitPreProcess", "-Psquit.endpointPlaceholder=https://example.com", - "-Psquit.rootDir=$project", "-PtagsOr=call1,call2,call4" + "squitPreProcess", + "-Psquit.endpointPlaceholder=https://example.com", + "-Psquit.rootDir=$project", + "-PtagsOr=call1,call2,call4", ) val result = gradleRunner(project, arguments).buildAndFail() diff --git a/src/test/kotlin/de/smartsquare/squit/task/SquitPreProcessTaskGetTest.kt b/src/test/kotlin/de/smartsquare/squit/task/SquitPreProcessTaskGetTest.kt index 1eb09a68..3393cac1 100644 --- a/src/test/kotlin/de/smartsquare/squit/task/SquitPreProcessTaskGetTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/task/SquitPreProcessTaskGetTest.kt @@ -17,7 +17,9 @@ class SquitPreProcessTaskGetTest { @Test fun `normal run`() { val arguments = listOf( - "squitPreProcess", "-Psquit.endpointPlaceholder=https://example.com", "-Psquit.rootDir=$getProject" + "squitPreProcess", + "-Psquit.endpointPlaceholder=https://example.com", + "-Psquit.rootDir=$getProject", ) val result = gradleRunner(getProject, arguments).build() diff --git a/src/test/kotlin/de/smartsquare/squit/task/SquitPreProcessTaskJsonTest.kt b/src/test/kotlin/de/smartsquare/squit/task/SquitPreProcessTaskJsonTest.kt index 41fea65f..c1ba6388 100644 --- a/src/test/kotlin/de/smartsquare/squit/task/SquitPreProcessTaskJsonTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/task/SquitPreProcessTaskJsonTest.kt @@ -17,8 +17,9 @@ class SquitPreProcessTaskJsonTest { @Test fun `normal run`() { val arguments = listOf( - "squitPreProcess", "-Psquit.endpointPlaceholder=https://example.com", - "-Psquit.rootDir=$jsonProject" + "squitPreProcess", + "-Psquit.endpointPlaceholder=https://example.com", + "-Psquit.rootDir=$jsonProject", ) val result = gradleRunner(jsonProject, arguments).build() diff --git a/src/test/kotlin/de/smartsquare/squit/task/SquitPreProcessTaskOptionsTest.kt b/src/test/kotlin/de/smartsquare/squit/task/SquitPreProcessTaskOptionsTest.kt index 2c37e9d2..7bbffba7 100644 --- a/src/test/kotlin/de/smartsquare/squit/task/SquitPreProcessTaskOptionsTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/task/SquitPreProcessTaskOptionsTest.kt @@ -18,7 +18,9 @@ class SquitPreProcessTaskOptionsTest { @Test fun `normal run`() { val arguments = listOf( - "squitPreProcess", "-Psquit.endpointPlaceholder=https://example.com", "-Psquit.rootDir=$optionsProject" + "squitPreProcess", + "-Psquit.endpointPlaceholder=https://example.com", + "-Psquit.rootDir=$optionsProject", ) val result = gradleRunner(optionsProject, arguments).build() diff --git a/src/test/kotlin/de/smartsquare/squit/task/SquitPreProcessTaskPlaceholderTest.kt b/src/test/kotlin/de/smartsquare/squit/task/SquitPreProcessTaskPlaceholderTest.kt index 46c753f4..ef4dd8cb 100644 --- a/src/test/kotlin/de/smartsquare/squit/task/SquitPreProcessTaskPlaceholderTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/task/SquitPreProcessTaskPlaceholderTest.kt @@ -13,8 +13,11 @@ class SquitPreProcessTaskPlaceholderTest { @Test fun `normal run`() { val arguments = listOf( - "squitPreProcess", "-Psquit.endpointPlaceholder=https://example.com", "-Ptags=call2", - "-Psquit.rootDir=$projectWithPlaceholders", "-Psquit.placeholder2=test" + "squitPreProcess", + "-Psquit.endpointPlaceholder=https://example.com", + "-Ptags=call2", + "-Psquit.rootDir=$projectWithPlaceholders", + "-Psquit.placeholder2=test", ) val result = gradleRunner(projectWithPlaceholders, arguments).build() diff --git a/src/test/kotlin/de/smartsquare/squit/task/SquitPreProcessTaskTest.kt b/src/test/kotlin/de/smartsquare/squit/task/SquitPreProcessTaskTest.kt index 15f6c7de..5933b456 100644 --- a/src/test/kotlin/de/smartsquare/squit/task/SquitPreProcessTaskTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/task/SquitPreProcessTaskTest.kt @@ -38,8 +38,10 @@ class SquitPreProcessTaskTest { @Test fun `normal run`() { val arguments = listOf( - "squitPreProcess", "-Psquit.endpointPlaceholder=https://example.com", - "-Psquit.rootDir=$project", "-PtagsOr=call1,call2,call4" + "squitPreProcess", + "-Psquit.endpointPlaceholder=https://example.com", + "-Psquit.rootDir=$project", + "-PtagsOr=call1,call2,call4", ) val result = gradleRunner(project, arguments).build() @@ -85,8 +87,10 @@ class SquitPreProcessTaskTest { @Test fun `running with tags`() { val arguments = listOf( - "squitPreProcess", "-Psquit.endpointPlaceholder=https://example.com", - "-Psquit.rootDir=$project", "-PtagsAnd=project,unique" + "squitPreProcess", + "-Psquit.endpointPlaceholder=https://example.com", + "-Psquit.rootDir=$project", + "-PtagsAnd=project,unique", ) val result = gradleRunner(project, arguments).build() @@ -102,8 +106,10 @@ class SquitPreProcessTaskTest { @Test fun `running with the unignore flag`() { val arguments = listOf( - "squitPreProcess", "-Psquit.endpointPlaceholder=https://example.com", - "-Psquit.rootDir=$project", "-Psquit.titlePlaceholder=newTitle" + "squitPreProcess", + "-Psquit.endpointPlaceholder=https://example.com", + "-Psquit.rootDir=$project", + "-Psquit.titlePlaceholder=newTitle", ) val result = gradleRunner(project, arguments).build() @@ -118,8 +124,10 @@ class SquitPreProcessTaskTest { @Test fun `running with overriding config`() { val arguments = listOf( - "squitPreProcess", "-Psquit.endpointPlaceholder=https://example.com", - "-Psquit.rootDir=$project", "-Punignore" + "squitPreProcess", + "-Psquit.endpointPlaceholder=https://example.com", + "-Psquit.rootDir=$project", + "-Punignore", ) val result = gradleRunner(project, arguments).build() @@ -130,8 +138,11 @@ class SquitPreProcessTaskTest { @Test fun `running with build cache twice`() { val arguments = listOf( - "squitPreProcess", "-Psquit.endpointPlaceholder=https://example.com", - "-Psquit.rootDir=$project", "-Punignore", "--build-cache" + "squitPreProcess", + "-Psquit.endpointPlaceholder=https://example.com", + "-Psquit.rootDir=$project", + "-Punignore", + "--build-cache", ) val result = gradleRunner(project, arguments).build() diff --git a/src/test/kotlin/de/smartsquare/squit/task/SquitRequestTaskGetTest.kt b/src/test/kotlin/de/smartsquare/squit/task/SquitRequestTaskGetTest.kt index fe8cf797..30a4cfa5 100644 --- a/src/test/kotlin/de/smartsquare/squit/task/SquitRequestTaskGetTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/task/SquitRequestTaskGetTest.kt @@ -34,8 +34,9 @@ class SquitRequestTaskGetTest { server.enqueue(MockResponse().setBody("")) val arguments = listOf( - "squitRunRequests", "-Psquit.endpointPlaceholder=${server.url("/")}", - "-Psquit.rootDir=$getProject" + "squitRunRequests", + "-Psquit.endpointPlaceholder=${server.url("/")}", + "-Psquit.rootDir=$getProject", ) val result = gradleRunner(getProject, arguments).build() diff --git a/src/test/kotlin/de/smartsquare/squit/task/SquitRequestTaskInvalidSqlTest.kt b/src/test/kotlin/de/smartsquare/squit/task/SquitRequestTaskInvalidSqlTest.kt index f65fe322..a6a29658 100644 --- a/src/test/kotlin/de/smartsquare/squit/task/SquitRequestTaskInvalidSqlTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/task/SquitRequestTaskInvalidSqlTest.kt @@ -35,8 +35,9 @@ class SquitRequestTaskInvalidSqlTest { server.enqueue(MockResponse().setBody("")) val arguments = listOf( - "squitRunRequests", "-Psquit.endpointPlaceholder=${server.url("/")}", - "-Psquit.rootDir=$invalidProject2" + "squitRunRequests", + "-Psquit.endpointPlaceholder=${server.url("/")}", + "-Psquit.rootDir=$invalidProject2", ) val result = gradleRunner(invalidProject2, arguments).build() diff --git a/src/test/kotlin/de/smartsquare/squit/task/SquitRequestTaskJsonTest.kt b/src/test/kotlin/de/smartsquare/squit/task/SquitRequestTaskJsonTest.kt index 36ed48b1..d97a797a 100644 --- a/src/test/kotlin/de/smartsquare/squit/task/SquitRequestTaskJsonTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/task/SquitRequestTaskJsonTest.kt @@ -41,8 +41,9 @@ class SquitRequestTaskJsonTest { server.enqueue(MockResponse().setBody("{\n \"cool\": true\n}")) val arguments = listOf( - "squitRunRequests", "-Psquit.endpointPlaceholder=${server.url("/")}", - "-Psquit.rootDir=$jsonProject" + "squitRunRequests", + "-Psquit.endpointPlaceholder=${server.url("/")}", + "-Psquit.rootDir=$jsonProject", ) val result = gradleRunner(jsonProject, arguments).build() @@ -56,7 +57,7 @@ class SquitRequestTaskJsonTest { } val (expectedResponseCode) = SquitResponseInfo.fromJson( - Files.readAllBytes(jsonCall1ActualResponseInfo).toString(Charsets.UTF_8) + Files.readAllBytes(jsonCall1ActualResponseInfo).toString(Charsets.UTF_8), ) expectedResponseCode shouldBeInRange 200..599 diff --git a/src/test/kotlin/de/smartsquare/squit/task/SquitRequestTaskOptionsTest.kt b/src/test/kotlin/de/smartsquare/squit/task/SquitRequestTaskOptionsTest.kt index 0ff09787..e345dd75 100644 --- a/src/test/kotlin/de/smartsquare/squit/task/SquitRequestTaskOptionsTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/task/SquitRequestTaskOptionsTest.kt @@ -35,8 +35,9 @@ class SquitRequestTaskOptionsTest { server.enqueue(MockResponse().setBody("")) val arguments = listOf( - "squitRunRequests", "-Psquit.endpointPlaceholder=${server.url("/")}", - "-Psquit.rootDir=$optionsProject" + "squitRunRequests", + "-Psquit.endpointPlaceholder=${server.url("/")}", + "-Psquit.rootDir=$optionsProject", ) val result = gradleRunner(optionsProject, arguments).build() diff --git a/src/test/kotlin/de/smartsquare/squit/task/SquitRequestTaskTest.kt b/src/test/kotlin/de/smartsquare/squit/task/SquitRequestTaskTest.kt index ac277394..40554201 100644 --- a/src/test/kotlin/de/smartsquare/squit/task/SquitRequestTaskTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/task/SquitRequestTaskTest.kt @@ -59,8 +59,10 @@ class SquitRequestTaskTest { server.enqueue(MockResponse().setBody("")) val arguments = listOf( - "squitRunRequests", "-Psquit.endpointPlaceholder=${server.url("/")}", - "-Psquit.rootDir=$project", "-PtagsOr=call1,call2" + "squitRunRequests", + "-Psquit.endpointPlaceholder=${server.url("/")}", + "-Psquit.rootDir=$project", + "-PtagsOr=call1,call2", ) val result = gradleRunner(project, arguments).build() @@ -73,7 +75,7 @@ class SquitRequestTaskTest { val (date, duration) = SquitMetaInfo.fromJson( Files.readAllBytes(call1Meta) - .toString(Charset.defaultCharset()) + .toString(Charset.defaultCharset()), ) date shouldBeBefore LocalDateTime.now() @@ -113,8 +115,11 @@ class SquitRequestTaskTest { server.enqueue(MockResponse().setBody("error").setResponseCode(500)) val arguments = listOf( - "squitRunRequests", "-Psquit.endpointPlaceholder=${server.url("/")}", - "-Psquit.rootDir=$project", "-PtagsOr=call1", "--info" + "squitRunRequests", + "-Psquit.endpointPlaceholder=${server.url("/")}", + "-Psquit.rootDir=$project", + "-PtagsOr=call1", + "--info", ) val result = gradleRunner(project, arguments).build() @@ -130,8 +135,10 @@ class SquitRequestTaskTest { // Nothing enqueued to cause timeout. val arguments = listOf( - "squitRunRequests", "-Psquit.endpointPlaceholder=${server.url("/")}", - "-Psquit.rootDir=$project", "-Ptags=call1" + "squitRunRequests", + "-Psquit.endpointPlaceholder=${server.url("/")}", + "-Psquit.rootDir=$project", + "-Ptags=call1", ) val result = gradleRunner(project, arguments).build() @@ -147,8 +154,11 @@ class SquitRequestTaskTest { server.enqueue(MockResponse().setBody("").setHeader("Content-Type", "text/plain")) val arguments = listOf( - "squitRunRequests", "-Psquit.endpointPlaceholder=${server.url("/")}", - "-Psquit.rootDir=$project", "-Ptags=call1", "--info" + "squitRunRequests", + "-Psquit.endpointPlaceholder=${server.url("/")}", + "-Psquit.rootDir=$project", + "-Ptags=call1", + "--info", ) val result = gradleRunner(project, arguments).build() diff --git a/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskDifferentStructureTest.kt b/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskDifferentStructureTest.kt index 141ef36a..3cdfa3eb 100644 --- a/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskDifferentStructureTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskDifferentStructureTest.kt @@ -37,8 +37,9 @@ class SquitTestTaskDifferentStructureTest { server.enqueue(MockResponse().setBody("")) val arguments = listOf( - "squitTest", "-Psquit.endpointPlaceholder=${server.url("/")}", - "-Psquit.rootDir=$differentStructureProject" + "squitTest", + "-Psquit.endpointPlaceholder=${server.url("/")}", + "-Psquit.rootDir=$differentStructureProject", ) val result = gradleRunner(differentStructureProject, arguments).build() diff --git a/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskErrorResponseCodeTest.kt b/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskErrorResponseCodeTest.kt index 465df73e..2672adef 100644 --- a/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskErrorResponseCodeTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskErrorResponseCodeTest.kt @@ -33,8 +33,9 @@ class SquitTestTaskErrorResponseCodeTest { server.enqueue(MockResponse().setBody("{\n \"cool\": true\n}").setResponseCode(400)) val arguments = listOf( - "squitTest", "-Psquit.endpointPlaceholder=${server.url("/")}", - "-Psquit.rootDir=$projectWithResponseCode" + "squitTest", + "-Psquit.endpointPlaceholder=${server.url("/")}", + "-Psquit.rootDir=$projectWithResponseCode", ) val result = gradleRunner(projectWithResponseCode, arguments).build() @@ -47,8 +48,9 @@ class SquitTestTaskErrorResponseCodeTest { server.enqueue(MockResponse().setBody("{\n \"cool\": true\n}").setResponseCode(200)) val arguments = listOf( - "squitTest", "-Psquit.endpointPlaceholder=${server.url("/")}", - "-Psquit.rootDir=$projectWithResponseCode" + "squitTest", + "-Psquit.endpointPlaceholder=${server.url("/")}", + "-Psquit.rootDir=$projectWithResponseCode", ) val result = gradleRunner(projectWithResponseCode, arguments).buildAndFail() diff --git a/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskIgnoreFailuresTest.kt b/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskIgnoreFailuresTest.kt index e0dfdab1..bae6bdb3 100644 --- a/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskIgnoreFailuresTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskIgnoreFailuresTest.kt @@ -33,8 +33,9 @@ class SquitTestTaskIgnoreFailuresTest { server.enqueue(MockResponse().setBody("")) val arguments = listOf( - "squitTest", "-Psquit.endpointPlaceholder=${server.url("/")}", - "-Psquit.rootDir=$projectIgnoreFailures" + "squitTest", + "-Psquit.endpointPlaceholder=${server.url("/")}", + "-Psquit.rootDir=$projectIgnoreFailures", ) val result = gradleRunner(projectIgnoreFailures, arguments).build() diff --git a/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskJsonDifferentOrderTest.kt b/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskJsonDifferentOrderTest.kt index ba81eb84..401d4015 100644 --- a/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskJsonDifferentOrderTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskJsonDifferentOrderTest.kt @@ -40,13 +40,14 @@ class SquitTestTaskJsonDifferentOrderTest { "olleh": 321, "hello": "123" } - """.trimIndent() - ) + """.trimIndent(), + ), ) val arguments = listOf( - "squitTest", "-Psquit.endpointPlaceholder=${server.url("/")}", - "-Psquit.rootDir=$jsonProjectWithDifferentOrder" + "squitTest", + "-Psquit.endpointPlaceholder=${server.url("/")}", + "-Psquit.rootDir=$jsonProjectWithDifferentOrder", ) val result = gradleRunner(jsonProjectWithDifferentOrder, arguments).build() diff --git a/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskJsonTest.kt b/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskJsonTest.kt index f6904acd..fbccffb6 100644 --- a/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskJsonTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskJsonTest.kt @@ -33,8 +33,9 @@ class SquitTestTaskJsonTest { server.enqueue(MockResponse().setBody("{\n \"cool\": true\n}")) val arguments = listOf( - "squitTest", "-Psquit.endpointPlaceholder=${server.url("/")}", - "-Psquit.rootDir=$jsonProject" + "squitTest", + "-Psquit.endpointPlaceholder=${server.url("/")}", + "-Psquit.rootDir=$jsonProject", ) val result = gradleRunner(jsonProject, arguments).build() diff --git a/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskNonStrictXmlDiffingTest.kt b/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskNonStrictXmlDiffingTest.kt index 4edfabab..4f74f880 100644 --- a/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskNonStrictXmlDiffingTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskNonStrictXmlDiffingTest.kt @@ -33,8 +33,9 @@ class SquitTestTaskNonStrictXmlDiffingTest { server.enqueue(MockResponse().setBody("")) val arguments = listOf( - "squitTest", "-Psquit.endpointPlaceholder=${server.url("/")}", - "-Psquit.rootDir=$projectWithNonStrictXml" + "squitTest", + "-Psquit.endpointPlaceholder=${server.url("/")}", + "-Psquit.rootDir=$projectWithNonStrictXml", ) val result = gradleRunner(projectWithNonStrictXml, arguments).build() diff --git a/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskTest.kt b/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskTest.kt index d672b735..59c5b1ed 100644 --- a/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskTest.kt +++ b/src/test/kotlin/de/smartsquare/squit/task/SquitTestTaskTest.kt @@ -54,8 +54,9 @@ class SquitTestTaskTest { server.enqueue(MockResponse().setBody("")) val arguments = listOf( - "squitTest", "-Psquit.endpointPlaceholder=${server.url("/")}", - "-Psquit.rootDir=$project" + "squitTest", + "-Psquit.endpointPlaceholder=${server.url("/")}", + "-Psquit.rootDir=$project", ) val result = gradleRunner(project, arguments).build() @@ -83,8 +84,10 @@ class SquitTestTaskTest { server.enqueue(MockResponse().setBody("")) val arguments = listOf( - "squitTest", "-Psquit.endpointPlaceholder=${server.url("/")}", - "-Psquit.rootDir=$project", "-PtagsOr=call1,call2" + "squitTest", + "-Psquit.endpointPlaceholder=${server.url("/")}", + "-Psquit.rootDir=$project", + "-PtagsOr=call1,call2", ) val result = gradleRunner(project, arguments).buildAndFail() @@ -109,8 +112,10 @@ class SquitTestTaskTest { server.enqueue(MockResponse().setBody("")) val arguments = listOf( - "squitTest", "-Psquit.endpointPlaceholder=${server.url("/")}", - "-Psquit.rootDir=$project", "-Punignore" + "squitTest", + "-Psquit.endpointPlaceholder=${server.url("/")}", + "-Psquit.rootDir=$project", + "-Punignore", ) val result = gradleRunner(project, arguments).buildAndFail() @@ -129,8 +134,10 @@ class SquitTestTaskTest { server.enqueue(MockResponse().setBody("")) val arguments = listOf( - "squitTest", "-Psquit.endpointPlaceholder=${server.url("/")}", - "-Psquit.rootDir=$project", "-Punexclude" + "squitTest", + "-Psquit.endpointPlaceholder=${server.url("/")}", + "-Psquit.rootDir=$project", + "-Punexclude", ) val result = gradleRunner(project, arguments).buildAndFail() From 8b585596721898099ace7ae250d0f0ff309ff35a Mon Sep 17 00:00:00 2001 From: TrojanerHD Date: Tue, 29 Aug 2023 11:21:13 +0200 Subject: [PATCH 2/5] Change CI java version to 17 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bc1ee43d..17b446c4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: os: - ubuntu-latest - windows-latest - java: [8, 11, 17] + java: [17] steps: - uses: actions/checkout@v3 From d26cd3ea6c2addf2a2e936a072acf5f7f32bf8ae Mon Sep 17 00:00:00 2001 From: TrojanerHD Date: Thu, 31 Aug 2023 10:56:23 +0200 Subject: [PATCH 3/5] Change lowest supported Java version back to 1.8 and revert ci --- .github/workflows/ci.yml | 2 +- gradle/versions.gradle | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17b446c4..bc1ee43d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: os: - ubuntu-latest - windows-latest - java: [17] + java: [8, 11, 17] steps: - uses: actions/checkout@v3 diff --git a/gradle/versions.gradle b/gradle/versions.gradle index eb969a38..6884f902 100644 --- a/gradle/versions.gradle +++ b/gradle/versions.gradle @@ -1,5 +1,5 @@ ext { - javaVersion = JavaVersion.VERSION_17 + javaVersion = JavaVersion.VERSION_1_8 gradleVersion = '8.3' squitVersion = '5.1.0' @@ -18,7 +18,7 @@ ext { gsonVersion = '2.10.1' xmlSecVersion = '3.0.2' xmlUnitVersion = '2.9.1' - jsonUnitVersion = '3.0.0' + jsonUnitVersion = '2.38.0' typesafeConfigVersion = '1.4.2' okhttpVersion = '4.11.0' kotlinHtmlVersion = '0.9.1' From 69f3f3645d65e19a7946968cad182558eab73929 Mon Sep 17 00:00:00 2001 From: TrojanerHD Date: Wed, 6 Sep 2023 14:34:15 +0200 Subject: [PATCH 4/5] Remove kotlin toolchain and set java compatibility instead --- build.gradle | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 16e21aac..2a03515e 100644 --- a/build.gradle +++ b/build.gradle @@ -87,10 +87,9 @@ jacoco { toolVersion = jacocoVersion } -kotlin { - jvmToolchain { - languageVersion = JavaLanguageVersion.of(project.ext.javaVersion.majorVersion) - } +java { + sourceCompatibility = project.ext.javaVersion + targetCompatibility = project.ext.javaVersion } tasks.withType(KotlinCompile).all { From e373b67dc52ab3028e8fdc1ac8efeefdf32f9cf0 Mon Sep 17 00:00:00 2001 From: TrojanerHD Date: Thu, 7 Sep 2023 08:33:50 +0200 Subject: [PATCH 5/5] Remove unnecessary dependency versions --- gradle/versions.gradle | 2 -- 1 file changed, 2 deletions(-) diff --git a/gradle/versions.gradle b/gradle/versions.gradle index 6884f902..51faa61a 100644 --- a/gradle/versions.gradle +++ b/gradle/versions.gradle @@ -10,7 +10,6 @@ ext { jacocoVersion = '0.8.10' gradleVersionsVersion = '0.47.0' - gradleTestIdeaFixVersion = '0.1.0' jaxenVersion = '2.0.0' dom4jVersion = '2.1.4' @@ -36,7 +35,6 @@ ext { ktlintPluginVersion = '11.5.1' junitVersion = '5.10.0' - junitPlatformVersion = '1.7.2' kluentVersion = '1.73' h2Version = '2.2.220' mockkVersion = '1.13.7'