FixtureDirectory

class FixtureDirectory(val root: File)(source)

Reads fixtures beneath one explicit root, rejecting paths that escape it.

val fixtures = FixtureDirectory(File("src/test/fixtures"))
val json = fixtures.text("responses/videos.json")

Constructors

Link copied to clipboard
constructor(root: File)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
val root: File

The directory containing the fixtures; it need not exist yet.

Functions

Link copied to clipboard
fun bytes(name: String): ByteArray

Loads bytes from a relative path beneath root.

Link copied to clipboard
fun text(name: String): String

Loads a UTF-8 text fixture, preserving whitespace.