n.kotlin.generation.kotlin-code-generation-test.0.0.3.source-code.KotlinCompilationAssert.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlin-code-generation-test Show documentation
Show all versions of kotlin-code-generation-test Show documentation
Tools for testing generated classes. This lib exposes testing libraries and is supposed to be included
with `scope=test`
package io.toolisticon.kotlin.generation.test
import com.squareup.kotlinpoet.ExperimentalKotlinPoetApi
import com.tschuchort.compiletesting.KotlinCompilation
import io.toolisticon.kotlin.generation.test.model.KotlinCompilationResult
import org.assertj.core.api.AbstractAssert
import org.assertj.core.api.Assertions
import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
@ExperimentalKotlinPoetApi
@ExperimentalCompilerApi
class KotlinCompilationAssert(
actual: KotlinCompilationResult,
) : AbstractAssert(actual, KotlinCompilationAssert::class.java) {
fun errorMessages() = Assertions.assertThat(actual.errors)
fun hasExitCode(exitCode: KotlinCompilation.ExitCode): KotlinCompilationAssert = apply {
Assertions.assertThat(actual.exitCode).isEqualTo(exitCode)
}
}