All Downloads are FREE. Search and download functionalities are using the official Maven repository.

n.kotlin.generation.kotlin-code-generation-test.0.0.3.source-code.KotlinCompilationAssert.kt Maven / Gradle / Ivy

Go to download

Tools for testing generated classes. This lib exposes testing libraries and is supposed to be included with `scope=test`

There is a newer version: 0.0.9
Show 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


@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)
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy