doc / ch.tutteli.atrium.api.infix.en_GB / toBe

toBe

infix fun <T> Expect<T>.toBe(expected: T): Expect<T> (source)

Expects that the subject of the assertion is (equal to) expected.

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
An Expect for the current subject of the assertion.

infix fun <T : CharSequence> Expect<T>.toBe(empty: empty): Expect<T> (source)

Expects that the subject of the assertion (a CharSequence) CharSequence.kotlin.text.isEmpty.

Parameters

empty - Use the pseudo-keyword empty.

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
This assertion container to support a fluent API.

@JvmName("toBeNull") infix fun <T : BigDecimal> Expect<T?>.toBe(expected: Nothing?): Expect<T?> (source)

Expects that the subject of the assertion (a BigDecimal) is null.

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
An Expect for the current subject of the assertion.

infix fun <E, T : Optional<E>> Expect<T>.toBe(present: present): FeatureExpect<T, E> (source)

Expects that the subject of the assertion (an Optional) is present and returns an Expect for the inner type E.

Shortcut for more or less something like feature(Optional<T>::get) but with error handling; yet it depends on the underlying implementation though.

Exceptions

AssertionError - Might throw an AssertionError if the given assertion is not a success.

Return
The newly created Expect for the inner type E.

Since
0.12.0

infix fun <E, T : Optional<E>> Expect<T>.toBe(present: PresentWithCreator<E>): Expect<T> (source)

Expects that the subject of the assertion (an Optional) is present and that it holds all assertions the given PresentWithCreator.assertionCreator creates.

Exceptions

AssertionError - Might throw an AssertionError if the given assertions are not success.

Return
An Expect for the current subject of the assertion.

Since
0.12.0

infix fun <T : Path> Expect<T>.toBe(existing: existing): Expect<T> (source)

Expects that the subject of the assertion (a Path) exists; meaning that there is a file system entry at the location the Path points to.

This matcher resolves symbolic links. Therefore, if a symbolic link exists at the location the subject points to, then the search will continue at that location.

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
An Expect for the current subject of the assertion.

Since
0.12.0

infix fun <T : Path> Expect<T>.toBe(readable: readable): Expect<T> (source)

Expects that the subject of the assertion (a Path) is readable; meaning that there is a file system entry at the location the Path points to and that the current thread has the permission to read from it.

This matcher resolves symbolic links. Therefore, if a symbolic link exists at the location the subject points to, search will continue at the location the link points at.

This assertion is not atomic with respect to concurrent file system operations on the paths the assertions works on. Its result, in particular its extended explanations, may be wrong if such concurrent file system operations take place.

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
An Expect for the current subject of the assertion.

Since
0.12.0

infix fun <T : Path> Expect<T>.toBe(writable: writable): Expect<T> (source)

Expects that the subject of the assertion (a Path) is writable; meaning that there is a file system entry at the location the Path points to and that the current thread has the permission to write to it.

This matcher resolves symbolic links. Therefore, if a symbolic link exists at the location the subject points to, search will continue at the location the link points at.

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
An Expect for the current subject of the assertion.

Since
0.12.0

infix fun <T : Path> Expect<T>.toBe(aRegularFile: aRegularFile): Expect<T> (source)

Expects that the subject of the assertion (a Path) is a file; meaning that there is a file system entry at the location the Path points to and that is a regular file.

This matcher resolves symbolic links. Therefore, if a symbolic link exists at the location the subject points to, search will continue at the location the link points at.

This assertion is not atomic with respect to concurrent file system operations on the paths the assertions works on. Its result, in particular its extended explanations, may be wrong if such concurrent file system operations take place.

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
An Expect for the current subject of the assertion.

Since
0.12.0

infix fun <T : Path> Expect<T>.toBe(aDirectory: aDirectory): Expect<T> (source)

Expects that the subject of the assertion (a Path) is a directory; meaning that there is a file system entry at the location the Path points to and that is a directory.

This matcher resolves symbolic links. Therefore, if a symbolic link exists at the location the subject points to, search will continue at the location the link points at.

This assertion is not atomic with respect to concurrent file system operations on the paths the assertions works on. Its result, in particular its extended explanations, may be wrong if such concurrent file system operations take place.

Exceptions

AssertionError - Might throw an AssertionError if the assertion made is not correct.

Return
An Expect for the current subject of the assertion.

Since
0.12.0