package strikt.java

Subpackages

Name Description
package strikt.java.time

Fields

Name Description
val name: Builder<String>

Maps this assertion to an assertion on the name of the file of the subject.

val parent: Builder<String?>

Maps this assertion to an assertion on the parent file or null if the subject does not have a parent.

val parentFile: Builder<File?>

Maps this assertion to an assertion on the parent file or null if the subject does not have a parent.

val extension: Builder<String>

Maps this assertion to an assertion on the file extension (not including the dot) or empty string if it not have one.

val nameWithoutExtension: Builder<String>

Maps this assertion to an assertion on the file name without the extension.

val lastModified: Builder<Long>

Maps this assertion to an assertion on the last modified of the subject.

val length: Builder<Long>

Maps this assertion to an assertion on the file size of the subject.

val childFiles: Builder><List<File>>

Maps this assertion to an assertion on the child files of the subject.

Note: In contrast to File.listFiles, an empty list is returned for non-directory files.

val fileName: Builder<Path>

Maps this assertion to an assertion on the path representing the name of the subject.

val size: Builder<Long>

Maps this assertion to an assertion over the byte size of the subject path.

Methods

propertiesAreEqualTo

infix fun <T : Any> Assertion.Builder<T>.propertiesAreEqualTo(other: T): Assertion.Builder<T>

Asserts that all properties of the subject match those of other according to either contentEquals in the case of array properties or isEqualTo in other cases.

Properties are identified using Java beans conventions.

Receiver

Name Description
Assertion.Builder<T>

Parameters

Name Description
other: T

ReturnValue

Name Description
Assertion.Builder<T>

toPath

fun <T : File> Builder<T>.toPath(): Builder<Path>

Maps this assertion to an assertion on a path object representing this subject.

Receiver

Name Description
Builder<T>

ReturnValue

Name Description
Builder<Path>

lines

fun <T : File> Builder<T>.lines(charset: Charset): Builder><List<String>>

Maps this assertion to an assertion on the lines of the subject decoded using the provided charset.

Receiver

Name Description
Builder<T>

Parameters

Name Description
charset: Charset

the charset used to decode the content

ReturnValue

Name Description
Builder><List<String>>

text

fun <T : File> Builder<T>.text(charset: Charset): Builder<String>

Maps this assertion to an assertion on the complete text of the subject decoded using the provided charset.

Receiver

Name Description
Builder<T>

Parameters

Name Description
charset: Charset

the charset used to decode the content

ReturnValue

Name Description
Builder<String>

childFile

fun <T : File> Builder<T>.childFile(name: String): Builder<File>

Maps this assertion to an assertion on a specific child name of the subject.

Receiver

Name Description
Builder<T>

Parameters

Name Description
name: String

ReturnValue

Name Description
Builder<File>

exists

fun <T : File> Builder<T>.exists(): Builder<T>

Asserts that the file exists.

Receiver

Name Description
Builder<T>

ReturnValue

Name Description
Builder<T>

exists

fun <T : Path> Builder<T>.exists(vararg options: LinkOption): Builder<T>

Asserts that the subject exists, handling symbolic links according to the provided options

Receiver

Name Description
Builder<T>

Parameters

Name Description
vararg options: LinkOption

the options indicating how symbolic links are handled

ReturnValue

Name Description
Builder<T>

notExists

fun <T : File> Builder<T>.notExists(): Builder<T>

Asserts that the file not exists.

Receiver

Name Description
Builder<T>

ReturnValue

Name Description
Builder<T>

isRegularFile

fun <T : File> Builder<T>.isRegularFile(): Builder<T>

Asserts that the file is a regular file.

Receiver

Name Description
Builder<T>

ReturnValue

Name Description
Builder<T>

isRegularFile

fun <T : Path> Builder<T>.isRegularFile(vararg options: LinkOption): Builder<T>

Asserts that the subject is a regular file, handling symbolic links according to the provided options.

Receiver

Name Description
Builder<T>

Parameters

Name Description
vararg options: LinkOption

the options indicating how symbolic links are handled

ReturnValue

Name Description
Builder<T>

isNotRegularFile

fun <T : File> Builder<T>.isNotRegularFile(): Builder<T>

Asserts that the file is not a regular file.

Receiver

Name Description
Builder<T>

ReturnValue

Name Description
Builder<T>

isDirectory

fun <T : File> Builder<T>.isDirectory(): Builder<T>

Asserts that the file is a directory.

Receiver

Name Description
Builder<T>

ReturnValue

Name Description
Builder<T>

isDirectory

fun <T : Path> Builder<T>.isDirectory(vararg options: LinkOption): Builder<T>

Asserts that the subject is a directory, handling symbolic links according to the provided options.

Receiver

Name Description
Builder<T>

Parameters

Name Description
vararg options: LinkOption

the options indicating how symbolic links are handled

ReturnValue

Name Description
Builder<T>

isNotDirectory

fun <T : File> Builder<T>.isNotDirectory(): Builder<T>

Asserts that the file is not a directory.

Receiver

Name Description
Builder<T>

ReturnValue

Name Description
Builder<T>

isReadable

fun <T : File> Builder<T>.isReadable(): Builder<T>

Asserts that the file is readable.

Receiver

Name Description
Builder<T>

ReturnValue

Name Description
Builder<T>

isNotReadable

fun <T : File> Builder<T>.isNotReadable(): Builder<T>

Asserts that the file is not readable.

Receiver

Name Description
Builder<T>

ReturnValue

Name Description
Builder<T>

isWritable

fun <T : File> Builder<T>.isWritable(): Builder<T>

Asserts that the file is writable.

Receiver

Name Description
Builder<T>

ReturnValue

Name Description
Builder<T>

isNotWritable

fun <T : File> Builder<T>.isNotWritable(): Builder<T>

Asserts that the file is not writable.

Receiver

Name Description
Builder<T>

ReturnValue

Name Description
Builder<T>

isExecutable

fun <T : File> Builder<T>.isExecutable(): Builder<T>

Asserts that the file is executable.

Receiver

Name Description
Builder<T>

ReturnValue

Name Description
Builder<T>

isNotExecutable

fun <T : File> Builder<T>.isNotExecutable(): Builder<T>

Asserts that the file is not executable.

Receiver

Name Description
Builder<T>

ReturnValue

Name Description
Builder<T>

isPresent

fun <T> Assertion.Builder><Optional<T>>.isPresent(): Assertion.Builder<T>

Asserts that an Optional contains a value (is not empty) and returns an assertion builder whose subject is the value.

Receiver

Name Description
Assertion.Builder><Optional<T>>

ReturnValue

Name Description
Assertion.Builder<T>

isAbsent

fun <T> Assertion.Builder><Optional<T>>.isAbsent(): Assertion.Builder><Optional<T>>

Asserts that an Optional does not contain a value.

Receiver

Name Description
Assertion.Builder><Optional<T>>

ReturnValue

Name Description
Assertion.Builder><Optional<T>>

toNullable

fun <T> Assertion.Builder><Optional<T>>.toNullable(): Assertion.Builder<T?>

Maps an assertion on a Java Optional to a Kotlin nullable type.

Receiver

Name Description
Assertion.Builder><Optional<T>>

ReturnValue

Name Description
Assertion.Builder<T?>

endsWith

infix fun <T : Path> Builder<T>.endsWith(other: Path): Builder<T>

Asserts that the subject end with the provided path.

Receiver

Name Description
Builder<T>

Parameters

Name Description
other: Path

the given path

ReturnValue

Name Description
Builder<T>

endsWith

infix fun <T : Path> Builder<T>.endsWith(other: String): Builder<T>

Asserts that the subject end with the provided path string.

Receiver

Name Description
Builder<T>

Parameters

Name Description
other: String

the given path string

ReturnValue

Name Description
Builder<T>

isAbsolute

fun <T : Path> Builder<T>.isAbsolute(): Builder<T>

Asserts that the subject is an absolute path.

Receiver

Name Description
Builder<T>

ReturnValue

Name Description
Builder<T>

resolve

infix fun <T : Path> Builder<T>.resolve(other: Path): Builder<Path>

Maps this assertion to an assertion of this subject resolved with the provided path.

Receiver

Name Description
Builder<T>

Parameters

Name Description
other: Path

the path to resolve against this subject's path

ReturnValue

Name Description
Builder<Path>

resolve

infix fun <T : Path> Builder<T>.resolve(other: String): Builder<Path>

Maps this assertion to an assertion of this subject resolved with the provided path.

Receiver

Name Description
Builder<T>

Parameters

Name Description
other: String

the path string to resolve against this subject's path

ReturnValue

Name Description
Builder<Path>

startsWith

infix fun <T : Path> Builder<T>.startsWith(other: Path): Builder<T>

Asserts that the subject starts with the provided path.

Receiver

Name Description
Builder<T>

Parameters

Name Description
other: Path

the given path

ReturnValue

Name Description
Builder<T>

startsWith

infix fun <T : Path> Builder<T>.startsWith(other: String): Builder<T>

Asserts that the subject starts with the provided path.

Receiver

Name Description
Builder<T>

Parameters

Name Description
other: String

the given path string

ReturnValue

Name Description
Builder<T>

toFile

fun <T : Path> Builder<T>.toFile(): Builder<File>

Maps this assertion to an assertion on the file object representing this subject.

Receiver

Name Description
Builder<T>

ReturnValue

Name Description
Builder<File>

isSymbolicLink

fun <T : Path> Builder<T>.isSymbolicLink(): Builder<T>

Asserts that the subject is a symbolic link.

Receiver

Name Description
Builder<T>

ReturnValue

Name Description
Builder<T>

allBytes

fun <T : Path> Builder<T>.allBytes(): Builder<ByteArray>

Maps this assertion to an assertion over all bytes of this subject path .

Receiver

Name Description
Builder<T>

ReturnValue

Name Description
Builder<ByteArray>

allLines

fun <T : Path> Builder<T>.allLines(charset: Charset): Builder><List<String>>

Maps this assertion to an assertion over all lines of this subject path decoded using the provided charset.

Receiver

Name Description
Builder<T>

Parameters

Name Description
charset: Charset

the charset to use in decoding

ReturnValue

Name Description
Builder><List<String>>