n.kotlin.generation.kotlin-code-generation-test.0.1.0.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`
The newest version!
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
/**
* Assertj assertion for compilation result.
*/
@ExperimentalKotlinPoetApi
@ExperimentalCompilerApi
class KotlinCompilationAssert(
actual: KotlinCompilationResult,
) : AbstractAssert(actual, KotlinCompilationAssert::class.java) {
/**
* Assertions on error messages.
*/
fun errorMessages() = Assertions.assertThat(actual.errors)
/**
* Assertion on exitCode.
*/
fun hasExitCode(exitCode: KotlinCompilation.ExitCode): KotlinCompilationAssert = apply {
Assertions.assertThat(actual.exitCode).isEqualTo(exitCode)
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy