com.autonomousapps.kit.gradle.Imports.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of gradle-testkit-support Show documentation
Show all versions of gradle-testkit-support Show documentation
A DSL for building test fixtures with Gradle TestKit
The newest version!
package com.autonomousapps.kit.gradle
import com.autonomousapps.kit.render.Scribe
public class Imports(
private val imports: MutableList,
) {
public constructor(vararg imports: Import) : this(imports.toMutableList())
init {
require(imports.isNotEmpty()) { "Imports must not be empty" }
}
public fun render(scribe: Scribe): String {
return scribe.line { s ->
imports.forEach { it.render(s) }
}
}
public companion object {
@JvmStatic
public fun of(vararg imports: String): Imports {
return Imports(imports.mapTo(mutableListOf()) { Import(it) })
}
@JvmStatic
public fun of(imports: Iterable): Imports {
return Imports(imports.mapTo(mutableListOf()) { Import(it) })
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy