[Infrastructure] Assert dumps don't exist without directive

#KT-58697 Fixed
This commit is contained in:
Kirill Rakhman
2024-02-23 16:12:16 +01:00
committed by Space Team
parent 42f6eb4eb4
commit 5e83350576
58 changed files with 138 additions and 5876 deletions
@@ -9,6 +9,8 @@ import java.io.File
import java.nio.file.Path
abstract class Assertions {
val isTeamCityBuild: Boolean = System.getenv("TEAMCITY_VERSION") != null
fun assertEqualsToFile(expectedFile: File, actual: String, sanitizer: (String) -> String = { it }) {
assertEqualsToFile(expectedFile, actual, sanitizer) { "Actual data differs from file content" }
}
@@ -24,6 +26,15 @@ abstract class Assertions {
message: (() -> String)
)
fun assertFileDoesntExist(file: File, errorMessage: () -> String) {
if (file.exists()) {
if (!isTeamCityBuild) {
file.delete()
}
fail(errorMessage)
}
}
abstract fun assertEquals(expected: Any?, actual: Any?, message: (() -> String)? = null)
abstract fun assertNotEquals(expected: Any?, actual: Any?, message: (() -> String)? = null)
abstract fun assertTrue(value: Boolean, message: (() -> String)? = null)