### Assert List Starts With Elements (Kotlin) Source: https://assertk-org.github.io/assertk/assertk/assertk/-assert/index Asserts that a List begins with a specific sequence of elements in the same order. This is useful for verifying list prefixes. ```kotlin fun Assert>.startsWith(vararg elements: Any?) ``` -------------------------------- ### Assert CharSequence Starts With (Kotlin) Source: https://assertk-org.github.io/assertk/assertk/assertk/-assert/index Asserts that a CharSequence starts with another CharSequence, with an option to ignore case. This is common for string prefix checks. ```kotlin fun Assert.startsWith(other: CharSequence, ignoreCase: Boolean = false) ``` -------------------------------- ### AssertK 'get' Function Implementation (commonjs, native, wasmJs) Source: https://assertk-org.github.io/assertk/assertk/assertk/-thread-local-ref/get Provides the actual implementation of the 'get' function for different JavaScript targets: commonjs, native, and wasmJs. These implementations ensure the function is available and works correctly in each environment. ```kotlin actual fun get(): T ``` ```kotlin actual fun get(): T ``` ```kotlin actual fun get(): T ``` -------------------------------- ### Starts With Assertion Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/index Asserts that a list starts with the specified elements in order, or that a character sequence starts with another character sequence. ```APIDOC ## Starts With Assertion ### Description Asserts the list starts with the expected elements, in the same order. Asserts the char sequence starts with the expected char sequence. ### Method Not applicable (extension function) ### Endpoint Not applicable ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin // Example usage (conceptual) assertThat(listOf(1, 2, 3)).startsWith(1, 2) assertThat("hello world").startsWith("hello") assertThat("hello world").startsWith("HELLO", ignoreCase = true) ``` ### Response #### Success Response (200) Void (assertion is performed). #### Response Example None ``` -------------------------------- ### AssertK 'get' Function Signature (Kotlin) Source: https://assertk-org.github.io/assertk/assertk/assertk/-thread-local-ref/get Defines the expected signature for the 'get' function in AssertK. This is a generic function that returns a value of type T. ```kotlin expect fun get(): T ``` -------------------------------- ### Get File Extension Assertion (JVM) Source: https://assertk-org.github.io/assertk/assertk/assertk/-assert/index Returns an assertion object for the extension of a file. This allows chaining assertions specifically on the file's extension string. ```kotlin fun Assert.extension(): Assert ``` -------------------------------- ### List startsWith Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/starts-with Asserts that a List begins with a specified sequence of elements in the same order. ```APIDOC ## POST /websites/assertk-org_github_io_assertk/startsWith ### Description Asserts the list starts with the expected elements, in the same order. ### Method POST ### Endpoint /websites/assertk-org_github_io_assertk/startsWith ### Parameters #### Query Parameters - **elements** (Any*) - Required - The elements the list should start with. ### Request Example ```json { "assertion": "startsWith", "value": [1, 2, 3], "params": { "elements": [1, 2] } } ``` ### Response #### Success Response (200) - **result** (Boolean) - True if the assertion passes, false otherwise. #### Response Example ```json { "result": true } ``` ### See also endsWith ``` -------------------------------- ### CharSequence startsWith Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/starts-with Asserts that a CharSequence begins with a specified prefix, with an option to ignore case. ```APIDOC ## POST /websites/assertk-org_github_io_assertk/startsWith ### Description Asserts the char sequence starts with the expected char sequence. ### Method POST ### Endpoint /websites/assertk-org_github_io_assertk/startsWith ### Parameters #### Query Parameters - **other** (CharSequence) - Required - The prefix to check for. - **ignoreCase** (Boolean) - Optional - True to compare ignoring case, the default is false. ### Request Example ```json { "assertion": "startsWith", "value": "hello world", "params": { "other": "hello", "ignoreCase": false } } ``` ### Response #### Success Response (200) - **result** (Boolean) - True if the assertion passes, false otherwise. #### Response Example ```json { "result": true } ``` ### See also endsWith ``` -------------------------------- ### Table1 Class and Methods Source: https://assertk-org.github.io/assertk/assertk/assertk/-table1/index Documentation for the Table1 class, including its constructor and methods for iterating and adding rows. ```APIDOC ## Table1 ### Description A table with rows of 1 value. ### See Also tableOf ### Members #### Functions ##### forAll - **Description**: Runs the given lambda for each row in the table. - **Method**: `fun` - **Parameters**: - `f` (C1) -> Unit - The lambda function to execute for each row. ##### row - **Description**: Adds a row to the table with the given values. - **Method**: `fun` - **Parameters**: - `val1` (C1) - The value for the single column in the new row. - **Returns**: `Table1` - The updated table with the new row added. ``` -------------------------------- ### AssertK isStrictlyBetween: Kotlin Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/is-strictly-between Asserts that the value is strictly between the provided start and end values. This assertion is non-inclusive, meaning the start and end values themselves will cause the assertion to fail. It requires the type `B` to be comparable. ```kotlin fun > Assert.isStrictlyBetween(start: A, end: A) ``` -------------------------------- ### Table Builder API Source: https://assertk-org.github.io/assertk/assertk/assertk/-table1-builder/index This section details the functionality for building tables and adding rows. ```APIDOC ## Table1Builder ### Description Builds a table with the given rows. ### Method Not applicable (Class definition) ### Endpoint Not applicable (Class definition) ### Members #### Functions ##### row Adds a row to the table with the given values. - **val1** (C1) - Required - The value to be added as a row. ### Request Example ```kotlin // Example of using the row function (conceptual) val table = Table1Builder() table.row("value1") ``` ### Response #### Success Response (200) - **Table1** (object) - The table with the added row. #### Response Example ```json { "example": "Table object with added row" } ``` ``` -------------------------------- ### Assert Hash Code Source: https://assertk-org.github.io/assertk/assertk/assertk/-assert/index Asserts that the value has a specific hash code. It also provides a way to get an assertion on the result of the `hashCode()` method. ```kotlin fun Assert.hasHashCode(hashCode: Int) fun Assert.hashCodeFun(): Assert ``` -------------------------------- ### Assert File Properties (JVM) Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/index Provides assertions for file name, parent directory, and full path. Requires JVM environment. ```kotlin fun Assert.name(): Assert fun Assert.parent(): Assert fun Assert.path(): Assert ``` -------------------------------- ### Property Assertion Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/index Asserts on a specific property of an object. It takes the property name and an extractor function to get the property value. ```APIDOC ## Property Assertion ### Description Returns an assert that asserts on the given property of the value. ### Method Not applicable (extension function) ### Endpoint Not applicable ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin // Example usage (conceptual) assertThat(myObject).prop("propertyName") { it.propertyName }.isEqualTo(expectedValue) ``` ### Response #### Success Response (200) An assertion object for the extracted property type. #### Response Example None (returns an assertion object) ``` -------------------------------- ### Assert File Properties (JVM) Source: https://assertk-org.github.io/assertk/assertk/assertk/-assert/index Provides assertions for file-related properties on JVM environments. Includes checks for direct children, extensions, names, paths, and whether a file is a directory. ```kotlin fun Assert.hasDirectChild(expected: File) fun Assert.hasExtension(expected: String) fun Assert.hasName(expected: String) fun Assert.hasPath(expected: String) fun Assert.isDirectory() ``` -------------------------------- ### ThreadLocalRef.get() Function (Kotlin) Source: https://assertk-org.github.io/assertk/assertk/assertk/-thread-local-ref/index The 'get()' function retrieves the current thread's value from the ThreadLocalRef. This function is available across multiple platforms. ```kotlin expect fun get(): T actual fun get(): T open fun get(): T actual fun get(): T actual fun get(): T ``` -------------------------------- ### Assert Path Exists (JVM) Source: https://assertk-org.github.io/assertk/assertk/assertk/-assert/index Asserts that a given `Path` exists in the file system. Optional `LinkOption` arguments can control how symbolic links are handled. ```kotlin fun Assert.exists(vararg options: LinkOption) ``` -------------------------------- ### Get Hash Code Assert (Kotlin) Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/index Returns an assertion object for the hash code of a value. This allows for chained assertions on the result of the `hashCode()` method. ```kotlin fun Assert.hashCodeFun(): Assert ``` -------------------------------- ### Assert.all Function for Batch Assertions Source: https://assertk-org.github.io/assertk/assertk/assertk/index Implements the 'all' extension function for 'Assert'. It allows running multiple assertions within a lambda block, either with a default or a custom message. ```kotlin fun Assert.all(body: Assert.() -> Unit) fun Assert.all(message: String, body: Assert.() -> Unit) ``` -------------------------------- ### ThreadLocalRef.value Property (Kotlin) Source: https://assertk-org.github.io/assertk/assertk/assertk/-thread-local-ref/index The 'value' property allows access to the thread-local value. It can be read and written to, providing a way to get or set the current thread's value. ```kotlin var ThreadLocalRef.value: T ``` -------------------------------- ### Get Java Class Assertion (JVM Kotlin) Source: https://assertk-org.github.io/assertk/assertk/assertk/-assert/index Returns an assertion object for the Java Class of the given value. This allows for assertions specifically on the class type, such as checking its name or superclass. This is JVM-specific. ```kotlin fun Assert.jClass(): Assert> ``` -------------------------------- ### Assert File Path (Kotlin) Source: https://assertk-org.github.io/assertk/assertk/assertk/-assert/index Returns an assertion on the full path of a File. This allows for detailed path-related assertions. ```kotlin fun Assert.path(): Assert ``` -------------------------------- ### AssertK isBetween Function (Kotlin) Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/is-between Asserts that a comparable value is inclusively between the provided start and end values. This function is part of the AssertK assertion library for Kotlin. It requires the type `A` to be `Comparable`. ```kotlin fun > Assert.isBetween(start: A, end: A) ``` -------------------------------- ### show Function Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions.support/index Shows the primary value in a failure message, optionally wrapped. ```APIDOC ## show ### Description Shows the primary value in a failure message. ### Method Function ### Endpoint N/A (Library Function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin // Example usage within AssertK context val formattedValue = show(someValue, "[]") ``` ### Response #### Success Response (200) - **String**: The formatted string representation of the value. #### Response Example ```json { "example": "[value]" } ``` ``` -------------------------------- ### Iterate Over Table3 Rows with forAll Source: https://assertk-org.github.io/assertk/assertk/assertk/-table3/index The `forAll` function iterates through each row of a Table3 instance. It accepts a lambda function that takes three arguments, corresponding to the values in each column of a row. This is useful for performing operations on every entry in the table. ```kotlin fun forAll(f: (C1, C2, C3) -> Unit) ``` -------------------------------- ### Get Kotlin Class Assertion (Kotlin) Source: https://assertk-org.github.io/assertk/assertk/assertk/-assert/index Returns an assertion object for the Kotlin KClass of the given value. This allows for assertions specifically on the Kotlin class type, such as checking its name or modifiers. This is a common Kotlin assertion. ```kotlin fun Assert.kClass(): Assert> ``` -------------------------------- ### Assert File Name (Kotlin) Source: https://assertk-org.github.io/assertk/assertk/assertk/-assert/index Returns an assertion on the name of a File. This allows for assertions specifically on the file's name string. ```kotlin fun Assert.name(): Assert ``` -------------------------------- ### AssertK isInstanceOf with Java Class Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/is-instance-of Asserts that the value is an instance of the expected Java class. This is useful when working with Java types or interoperability. Example: assertThat("test").isInstanceOf(String::class.java) ```kotlin fun Assert.isInstanceOf(jclass: Class): Assert ``` -------------------------------- ### AssertK isInstanceOf with Kotlin KClass Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/is-instance-of Asserts that the value is an instance of the expected Kotlin class provided as a KClass object. This method is useful when the type is determined dynamically. Example: assertThat("test").isInstanceOf(String::class) ```kotlin fun Assert.isInstanceOf(kclass: KClass): Assert ``` -------------------------------- ### Format Value for Failure Messages with show() (Kotlin) Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions.support/show The show() function formats a primary value for inclusion in assertion failure messages. It accepts the value to display and an optional wrapping string, defaulting to '<>'. This is useful for clearly presenting the actual value that caused an assertion to fail. ```kotlin fun show(value: Any?, wrap: String = "<>"): String ``` -------------------------------- ### AssertK isInstanceOf with Kotlin Reified Type Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/is-instance-of Asserts that the value is an instance of the expected Kotlin class using reified type parameters. This provides a type-safe way to check the instance type. Example: assertThat("test").isInstanceOf() ```kotlin inline fun Assert.isInstanceOf(): Assert ``` -------------------------------- ### Assert File Parent (Kotlin) Source: https://assertk-org.github.io/assertk/assertk/assertk/-assert/index Returns an assertion on the parent directory of a File. This is useful for verifying the directory structure. ```kotlin fun Assert.parent(): Assert ``` -------------------------------- ### Assert Path Properties (JVM) Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/index Asserts properties of a java.nio.file.Path, such as readability, writability, being a regular file, or a symbolic link. Supports optional link options. ```kotlin fun Assert.isReadable() fun Assert.isWritable() fun Assert.isRegularFile(vararg options: LinkOption) fun Assert.isSymbolicLink() fun Assert.isSameFileAs(expected: Path) ``` -------------------------------- ### File Assertions Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/index Assertions for file system operations, checking existence and extensions. ```APIDOC ## Assert.exists ### Description Asserts the file exists. ### Method `fun` ### Endpoint N/A (Extension function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin val file = File("test.txt") assertThat(file).exists() ``` ### Response #### Success Response (200) Passes if the file exists. #### Response Example N/A ``` ```APIDOC ## Assert.exists ### Description Assert that the path exists, with optional link options. ### Method `fun` ### Endpoint N/A (Extension function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin import java.nio.file.Paths val path = Paths.get("test.txt") assertThat(path).exists() assertThat(path).exists(LinkOption.NOFOLLOW_LINKS) ``` ### Response #### Success Response (200) Passes if the path exists. #### Response Example N/A ``` ```APIDOC ## Assert.extension ### Description Returns an assert on the file's extension. ### Method `fun` ### Endpoint N/A (Extension function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin val file = File("document.pdf") assertThat(file).extension().isEqualTo("pdf") ``` ### Response #### Success Response (200) An `Assert` object for the file's extension string. #### Response Example N/A ``` ```APIDOC ## Assert.hasExtension ### Description Asserts the file has the expected extension. ### Method `fun` ### Endpoint N/A (Extension function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin val file = File("image.jpg") assertThat(file).hasExtension("jpg") ``` ### Response #### Success Response (200) Passes if the file has the specified extension. #### Response Example N/A ``` ```APIDOC ## Assert.hasDirectChild ### Description Asserts the file has the expected direct child. ### Method `fun` ### Endpoint N/A (Extension function) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin val parentDir = File("parent") val childFile = File(parentDir, "child.txt") assertThat(parentDir).hasDirectChild(childFile) ``` ### Response #### Success Response (200) Passes if the file has the specified direct child. #### Response Example N/A ``` -------------------------------- ### Assert File Lines (JVM) Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/index Asserts on the lines of a file, returning an assertion on a list of strings. Allows specifying character set, defaults to UTF-8. ```kotlin jvm fun Assert.lines(charset: Charset = Charsets.UTF_8): Assert> ``` -------------------------------- ### isEqualTo for String Types (Case-Insensitive Option) Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/is-equal-to Asserts that a string is equal to the expected string, with an option to ignore case. ```APIDOC ## POST /isEqualTo/string ### Description Asserts the string is equal to the expected string. ### Method POST ### Endpoint /isEqualTo/string ### Parameters #### Request Body - **expected** (String) - Required - The string to compare against. - **ignoreCase** (Boolean) - Optional - True to compare ignoring case, defaults to false. ### Request Example ```json { "expected": "HelloWorld", "ignoreCase": true } ``` ### Response #### Success Response (200) - **message** (string) - Indicates the assertion passed. #### Response Example ```json { "message": "Assertion passed: strings are equal (case-insensitive)." } ``` ``` -------------------------------- ### Assert Path is Directory with Link Options (Kotlin) Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/is-directory Asserts that a given Path object represents a directory, with support for specifying LinkOptions to control how symbolic links are handled. This allows for flexible directory checks. ```kotlin fun Assert.isDirectory(vararg options: LinkOption) Assert that the path is a directory. Parameters _options_ indicating how symbolic links are handled ``` -------------------------------- ### File and Path Assertions Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/index Assertions for checking properties of files and paths, such as executability, hidden status, and whether it's a file. ```APIDOC ## POST /assert/path/isExecutable ### Description Asserts that a given path points to an executable file. ### Method POST ### Endpoint /assert/path/isExecutable ### Parameters #### Request Body - **path** (String) - The path to check. ### Request Example ```json { "path": "/usr/bin/my_script" } ``` ### Response #### Success Response (200) - **message** (String) - A success message indicating the assertion passed. #### Response Example ```json { "message": "Assertion passed: Path is executable." } ``` ## POST /assert/path/isHidden ### Description Asserts that a given path is hidden. ### Method POST ### Endpoint /assert/path/isHidden ### Parameters #### Request Body - **path** (String) - The path to check. ### Request Example ```json { "path": "/home/user/.config" } ``` ### Response #### Success Response (200) - **message** (String) - A success message indicating the assertion passed. #### Response Example ```json { "message": "Assertion passed: Path is hidden." } ``` ## POST /assert/file/isFile ### Description Asserts that a given file path points to a regular file (not a directory). ### Method POST ### Endpoint /assert/file/isFile ### Parameters #### Request Body - **filePath** (String) - The path to the file. ### Request Example ```json { "filePath": "/home/user/document.txt" } ``` ### Response #### Success Response (200) - **message** (String) - A success message indicating the assertion passed. #### Response Example ```json { "message": "Assertion passed: Path is a file." } ``` ## POST /assert/file/isNotHidden ### Description Asserts that a given file is not hidden. ### Method POST ### Endpoint /assert/file/isNotHidden ### Parameters #### Request Body - **filePath** (String) - The path to the file. ### Request Example ```json { "filePath": "/home/user/public_file.txt" } ``` ### Response #### Success Response (200) - **message** (String) - A success message indicating the assertion passed. #### Response Example ```json { "message": "Assertion passed: File is not hidden." } ``` ``` -------------------------------- ### Custom Assertion Builder with 'given' Source: https://assertk-org.github.io/assertk/assertk/assertk/-assert/index Allows the creation of custom assertions by providing a lambda that operates on the actual value. This is a powerful tool for building reusable assertion logic. ```kotlin inline fun given(assertion: (T) -> Unit) ``` -------------------------------- ### Assert Class Properties Source: https://assertk-org.github.io/assertk/assertk/assertk/-assert/index Details about the properties available on the Assert class. ```APIDOC ## Properties ### name #### Description Represents the name associated with the assertion. #### Method GET #### Endpoint N/A (Property of a class) #### Parameters ##### Path Parameters None ##### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **name** (String?) - The name of the assertion, or null if not provided. #### Response Example ```json { "name": "myAssertionName" } ``` ``` -------------------------------- ### AssertK Kotlin: Check for Same Instance Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/is-same-instance-as This Kotlin code snippet demonstrates how to use the `isSameInstanceAs` function from the AssertK library. It asserts that the actual object reference is identical to the expected object reference, utilizing the `===` operator for comparison. This is useful for verifying object identity rather than value equality. ```kotlin import assertk.assertThat import assertk.assertions.isSameInstanceAs fun main() { val obj1 = Any() val obj2 = obj1 val obj3 = Any() assertThat(obj1).isSameInstanceAs(obj2) // The following assertion would fail: // assertThat(obj1).isSameInstanceAs(obj3) } ``` -------------------------------- ### Assert File Contents as Bytes (Kotlin) Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/bytes Provides an assertion object for the file's contents represented as a byte array. This is useful for verifying binary file integrity or content. ```kotlin fun Assert.bytes(): Assert Returns an assert on the file's contents as bytes. ``` ```kotlin fun Assert.bytes(): Assert Assert on file bytes ``` -------------------------------- ### Assert Path Is Regular File (JVM Kotlin) Source: https://assertk-org.github.io/assertk/assertk/assertk/-assert/index Asserts that a given file path points to a regular file. This assertion is specific to the JVM environment and operates on java.nio.file.Path objects. It can optionally consider symbolic link options. ```kotlin fun Assert.isRegularFile(vararg options: LinkOption) ``` -------------------------------- ### File Assertions Source: https://assertk-org.github.io/assertk/assertk/assertk/-assert/index Methods for asserting properties of File objects. ```APIDOC ## `hasDirectChild` ### Description Asserts the file has the expected direct child. ### Method `fun Assert.hasDirectChild(expected: File)` ### Parameters * **expected** (File) - Required - The expected direct child file. ### Request Example ```kotlin val parentFile = File("/path/to/parent") val childFile = File("/path/to/parent/child") assertThat(parentFile).hasDirectChild(childFile) ``` ### Response * **Success Response (200)**: Assertion passes if `expected` is a direct child of the file. ## `hasExtension` ### Description Asserts the file has the expected extension. ### Method `fun Assert.hasExtension(expected: String)` ### Parameters * **expected** (String) - Required - The expected file extension. ### Request Example ```kotlin val file = File("document.txt") assertThat(file).hasExtension("txt") ``` ### Response * **Success Response (200)**: Assertion passes if the file's extension matches `expected`. ## `hasName` ### Description Asserts the file has the expected name. ### Method `fun Assert.hasName(expected: String)` ### Parameters * **expected** (String) - Required - The expected file name. ### Request Example ```kotlin val file = File("/path/to/myfile.txt") assertThat(file).hasName("myfile.txt") ``` ### Response * **Success Response (200)**: Assertion passes if the file's name matches `expected`. ## `hasParent` ### Description Asserts the file has the expected parent path. ### Method `fun Assert.hasParent(expected: String)` ### Parameters * **expected** (String) - Required - The expected parent path. ### Request Example ```kotlin val file = File("/path/to/myfile.txt") assertThat(file).hasParent("/path/to") ``` ### Response * **Success Response (200)**: Assertion passes if the file's parent path matches `expected`. ## `hasPath` ### Description Asserts the file has the expected path. ### Method `fun Assert.hasPath(expected: String)` ### Parameters * **expected** (String) - Required - The expected file path. ### Request Example ```kotlin val file = File("/path/to/myfile.txt") assertThat(file).hasPath("/path/to/myfile.txt") ``` ### Response * **Success Response (200)**: Assertion passes if the file's path matches `expected`. ## `hasText` ### Description Asserts the file contains exactly the expected text (and nothing else). ### Method `fun Assert.hasText(expected: String, charset: Charset = Charsets.UTF_8)` ### Parameters * **expected** (String) - Required - The expected text content. * **charset** (Charset) - Optional - The character set to use when reading the file. Defaults to `Charsets.UTF_8`. ### Request Example ```kotlin val file = File("my_file.txt") // Assuming my_file.txt contains "Hello, AssertK!" assertThat(file).hasText("Hello, AssertK!") ``` ### Response * **Success Response (200)**: Assertion passes if the file's content exactly matches `expected`. ## `isDirectory` ### Description Asserts the file is a directory. ### Method `fun Assert.isDirectory()` ### Request Example ```kotlin val directory = File("/path/to/directory") assertThat(directory).isDirectory() ``` ### Response * **Success Response (200)**: Assertion passes if the file represents a directory. ``` -------------------------------- ### Assert File Exists (JVM) Source: https://assertk-org.github.io/assertk/assertk/assertk/-assert/index Asserts that a given `File` object represents an existing file on the file system. This is a common check for file operations. ```kotlin fun Assert.exists() ``` -------------------------------- ### isEqualToIgnoringGivenProperties Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/is-equal-to-ignoring-given-properties Compares all accessible properties of an object except for the ones specified. This is useful for comparing objects where certain properties should not be considered in the assertion. ```APIDOC ## isEqualToIgnoringGivenProperties ### Description Asserts that the actual value is equal to the other value, ignoring the specified properties. ### Method Extension Function (JVM) ### Endpoint N/A (This is a JVM assertion, not a REST endpoint) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin assertThat(person).isEqualToIgnoringGivenProperties(other, Person::name, Person::age) ``` ### Response #### Success Response (Assertion Success) This assertion does not return a value directly but succeeds or fails. #### Response Example N/A ``` -------------------------------- ### General Equality and Data Class Assertions Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/index General equality checks and specific assertions for data classes. ```APIDOC ## POST /assertk/equality ### Description Provides general equality assertions and specific assertions for data classes. ### Method POST ### Endpoint /assertk/equality ### Parameters #### Request Body - **assertionType** (string) - Required - The type of assertion to perform (e.g., "isEqualTo", "isDataClassEqualTo"). - **expected** (any) - Required - The expected value for the assertion. ### Request Example ```json { "assertionType": "isEqualTo", "expected": "some value" } ``` ```json { "assertionType": "isDataClassEqualTo", "expected": {"property1": "value1", "property2": 123} } ``` ### Response #### Success Response (200) - **message** (string) - A success message indicating the assertion passed. #### Response Example ```json { "message": "Assertion passed: Value is equal to the expected one." } ``` ``` -------------------------------- ### File Assertions Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/index Assertions for File objects, including name, path, and content. ```APIDOC ## POST /assertk/file ### Description Provides assertion methods for File objects. ### Method POST ### Endpoint /assertk/file ### Parameters #### Request Body - **assertionType** (string) - Required - The type of assertion to perform (e.g., "hasName", "hasParent", "hasPath", "hasText", "isDirectory"). - **expected** (any) - Required - The expected value for the assertion. - **charset** (string) - Optional - The character set to use for text-based assertions (e.g., for `hasText`). Defaults to UTF-8. ### Request Example ```json { "assertionType": "hasName", "expected": "myFile.txt" } ``` ```json { "assertionType": "hasParent", "expected": "/path/to/parent" } ``` ```json { "assertionType": "hasPath", "expected": "/path/to/myFile.txt" } ``` ```json { "assertionType": "hasText", "expected": "File content.", "charset": "UTF-8" } ``` ```json { "assertionType": "isDirectory" } ``` ### Response #### Success Response (200) - **message** (string) - A success message indicating the assertion passed. #### Response Example ```json { "message": "Assertion passed: File has the expected name." } ``` ``` -------------------------------- ### Iterate Over Table2 Rows (Kotlin) Source: https://assertk-org.github.io/assertk/assertk/assertk/-table2/index The `forAll` function iterates through each row of a Table2, executing a provided lambda function for each row. This function takes a lambda that accepts two arguments corresponding to the two columns of the table. ```kotlin fun forAll(f: (C1, C2) -> Unit) ``` -------------------------------- ### Assert Path Is Symbolic Link (JVM Kotlin) Source: https://assertk-org.github.io/assertk/assertk/assertk/-assert/index Asserts that a given file path points to a symbolic link. This assertion is specific to the JVM environment and operates on java.nio.file.Path objects. ```kotlin fun Assert.isSymbolicLink() ``` -------------------------------- ### Property and Callable Assertions Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/index Methods for asserting on object properties and callable results. ```APIDOC ## prop ### Description Returns an assert that asserts on the given property or the result of calling a function. ### Method Extension Function ### Endpoint N/A (In-process assertion) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin // Example usage (conceptual) data class User(val name: String) val user = User("Alice") // Asserting on a property assertThat(user).prop(User::name).isEqualTo("Alice") // Asserting on a function call fun getUserAge(): Int = 30 assertThat(user).prop(::getUserAge).isEqualTo(30) ``` ### Response #### Success Response (Passes if assertion is true) N/A (In-process assertion) #### Response Example N/A ``` -------------------------------- ### Null and Empty Checks Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/index Methods for asserting whether a value is null or empty. ```APIDOC ## isNotNull ### Description Asserts the value is not null. You can pass in an optional lambda to run additional assertions on the non-null value. ### Method Extension Function ### Endpoint N/A (In-process assertion) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin // Example usage (conceptual) assertThat(myValue).isNotNull { // additional assertions on non-null myValue } ``` ### Response #### Success Response (Passes if assertion is true) N/A (In-process assertion) #### Response Example N/A ``` ```APIDOC ## isNull ### Description Asserts the value is null. ### Method Extension Function ### Endpoint N/A (In-process assertion) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin // Example usage (conceptual) assertThat(null).isNull() ``` ### Response #### Success Response (Passes if assertion is true) N/A (In-process assertion) #### Response Example N/A ``` ```APIDOC ## isNullOrEmpty ### Description Asserts the array, CharSequence, collection, or map is null or empty. ### Method Extension Function ### Endpoint N/A (In-process assertion) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin // Example usage (conceptual) assertThat(emptyList()).isNullOrEmpty() assertThat(null as List?).isNullOrEmpty() ``` ### Response #### Success Response (Passes if assertion is true) N/A (In-process assertion) #### Response Example N/A ``` -------------------------------- ### Path Assertions Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/index Methods for asserting properties of file paths. ```APIDOC ## isReadable ### Description Assert that the path is readable. ### Method Extension Function ### Endpoint N/A (In-process assertion) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin // Example usage (conceptual) import java.nio.file.Paths val readablePath = Paths.get("path/to/readable/file") assertThat(readablePath).isReadable() ``` ### Response #### Success Response (Passes if assertion is true) N/A (In-process assertion) #### Response Example N/A ``` ```APIDOC ## isWritable ### Description Assert that the path is writable. ### Method Extension Function ### Endpoint N/A (In-process assertion) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin // Example usage (conceptual) import java.nio.file.Paths val writablePath = Paths.get("path/to/writable/file") assertThat(writablePath).isWritable() ``` ### Response #### Success Response (Passes if assertion is true) N/A (In-process assertion) #### Response Example N/A ``` ```APIDOC ## isRegularFile ### Description Assert that the path is a regular file. ### Method Extension Function ### Endpoint N/A (In-process assertion) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin // Example usage (conceptual) import java.nio.file.Paths val regularFilePath = Paths.get("path/to/regular/file.txt") assertThat(regularFilePath).isRegularFile() ``` ### Response #### Success Response (Passes if assertion is true) N/A (In-process assertion) #### Response Example N/A ``` ```APIDOC ## isSymbolicLink ### Description Assert that the path is a symbolic link. ### Method Extension Function ### Endpoint N/A (In-process assertion) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin // Example usage (conceptual) import java.nio.file.Paths val symbolicLinkPath = Paths.get("path/to/symlink") assertThat(symbolicLinkPath).isSymbolicLink() ``` ### Response #### Success Response (Passes if assertion is true) N/A (In-process assertion) #### Response Example N/A ``` ```APIDOC ## isSameFileAs ### Description Assert that the path points to the same file as the other path. ### Method Extension Function ### Endpoint N/A (In-process assertion) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin // Example usage (conceptual) import java.nio.file.Paths val path1 = Paths.get("path/to/file") val path2 = Paths.get("path/to/file") // Assuming this points to the same file assertThat(path1).isSameFileAs(path2) ``` ### Response #### Success Response (Passes if assertion is true) N/A (In-process assertion) #### Response Example N/A ``` ```APIDOC ## lines ### Description Assert on file lines. Optionally specify charset. ### Method Extension Function ### Endpoint N/A (In-process assertion) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin // Example usage (conceptual) import java.nio.file.Paths import java.nio.charset.Charset val filePath = Paths.get("path/to/file.txt") assertThat(filePath).lines().contains("expected line") assertThat(filePath).lines(Charsets.UTF_16).isEmpty() ``` ### Response #### Success Response (Passes if assertion is true) N/A (In-process assertion) #### Response Example N/A ``` ```APIDOC ## name ### Description Returns an assert on the file's name. ### Method Extension Function ### Endpoint N/A (In-process assertion) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin // Example usage (conceptual) import java.nio.file.Paths val filePath = Paths.get("path/to/myfile.txt") assertThat(filePath).name().isEqualTo("myfile.txt") ``` ### Response #### Success Response (Passes if assertion is true) N/A (In-process assertion) #### Response Example N/A ``` ```APIDOC ## path ### Description Returns an assert on the file's path. ### Method Extension Function ### Endpoint N/A (In-process assertion) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin // Example usage (conceptual) import java.nio.file.Paths val filePath = Paths.get("path/to/myfile.txt") assertThat(filePath).path().isEqualTo("path/to/myfile.txt") ``` ### Response #### Success Response (Passes if assertion is true) N/A (In-process assertion) #### Response Example N/A ``` ```APIDOC ## parent ### Description Returns an assert on the file's parent directory path. ### Method Extension Function ### Endpoint N/A (In-process assertion) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin // Example usage (conceptual) import java.nio.file.Paths val filePath = Paths.get("path/to/myfile.txt") assertThat(filePath).parent().isEqualTo("path/to") ``` ### Response #### Success Response (Passes if assertion is true) N/A (In-process assertion) #### Response Example N/A ``` -------------------------------- ### Collection and Sequence Assertions Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/index Methods for asserting properties of collections and sequences. ```APIDOC ## none ### Description Asserts that none of the items in an iterable or sequence satisfy a given predicate. ### Method Extension Function ### Endpoint N/A (In-process assertion) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin // Example usage (conceptual) assertThat(listOf(1, 3, 5)).none { assert(it % 2 == 0) } ``` ### Response #### Success Response (Passes if assertion is true) N/A (In-process assertion) #### Response Example N/A ``` -------------------------------- ### Table and Table Builders for Assertions Source: https://assertk-org.github.io/assertk/assertk/assertk/index Defines the 'Table' sealed class and its various builder subclasses (Table1Builder, Table2Builder, etc.) for creating tables of data to run assertions on. This facilitates testing with multiple inputs and outputs. ```kotlin sealed class Table class Table1 : Table class Table1Builder : TableBuilder class Table2 : Table class Table2Builder : TableBuilder class Table3 : Table class Table3Builder : TableBuilder class Table4 : Table class Table4Builder : TableBuilder sealed class TableBuilder ``` -------------------------------- ### Array and Collection Assertions Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/index Assertions for arrays and collections, including size, emptiness, and element access. ```APIDOC ## POST /assertk/collection ### Description Provides assertion methods for arrays and collections, including size, emptiness, and element assertions. ### Method POST ### Endpoint /assertk/collection ### Parameters #### Request Body - **assertionType** (string) - Required - The type of assertion to perform (e.g., "hasSize", "isEmpty", "hasSameSizeAs", "index", "isEqualTo"). - **expected** (any) - Required - The expected value for the assertion. - **index** (integer) - Optional - The index to use for "index" assertions. ### Request Example ```json { "assertionType": "hasSize", "expected": 10 } ``` ```json { "assertionType": "isEmpty" } ``` ```json { "assertionType": "hasSameSizeAs", "expected": [1, 2, 3] } ``` ```json { "assertionType": "index", "index": 2, "expected": "specific value" } ``` ```json { "assertionType": "isEqualTo", "expected": ["a", "b", "c"] } ``` ### Response #### Success Response (200) - **message** (string) - A success message indicating the assertion passed. #### Response Example ```json { "message": "Assertion passed: Array has the expected size." } ``` ``` -------------------------------- ### tableOf Function for Table Builder Instantiation Source: https://assertk-org.github.io/assertk/assertk/assertk/index Provides the 'tableOf' function to create instances of 'TableBuilder' subclasses. It accepts one to four column names and returns the corresponding builder type (Table1Builder to Table4Builder). ```kotlin fun tableOf(name1: String): Table1Builder fun tableOf(name1: String, name2: String): Table2Builder fun tableOf(name1: String, name2: String, name3: String): Table3Builder fun tableOf(name1: String, name2: String, name3: String, name4: String): Table4Builder ``` -------------------------------- ### Assert Path Readable (JVM Kotlin) Source: https://assertk-org.github.io/assertk/assertk/assertk/-assert/index Asserts that a given file path is readable. This assertion is specific to the JVM environment and operates on java.nio.file.Path objects. ```kotlin fun Assert.isReadable() ``` -------------------------------- ### Build Table with Two Columns using Kotlin Source: https://assertk-org.github.io/assertk/assertk/assertk/table-of Constructs a table with two columns using the provided column names. This function is part of the AssertK library and returns a Table2Builder for further table construction. ```kotlin fun tableOf(name1: String, name2: String): Table2Builder ``` -------------------------------- ### Build Table with Three Columns using Kotlin Source: https://assertk-org.github.io/assertk/assertk/assertk/table-of Constructs a table with three columns using the provided column names. This function is part of the AssertK library and returns a Table3Builder for further table construction. ```kotlin fun tableOf(name1: String, name2: String, name3: String): Table3Builder ``` -------------------------------- ### Kotlin: Run all assertions in a lambda Source: https://assertk-org.github.io/assertk/assertk/assertk/all This function executes a block of assertions without an explicit message. The assertions are defined within the 'body' lambda, and all failures within this block will be reported. ```kotlin fun Assert.all(body: Assert.() -> Unit) assertThat("test", name = "test").all { startsWith("t") endsWith("t") } ``` -------------------------------- ### forAll Function Source: https://assertk-org.github.io/assertk/assertk/assertk/-table4/index Executes a provided lambda function for each row present in the Table4. ```APIDOC ## fun forAll(f: (C1, C2, C3, C4) -> Unit) ### Description Runs the given lambda for each row in the table. ### Method - **forAll** ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **f** (Function) - Required - A lambda function that takes four arguments (corresponding to the four columns of a row) and returns Unit. ``` -------------------------------- ### isNotEqualTo for String Source: https://assertk-org.github.io/assertk/assertk/assertk.assertions/is-not-equal-to Asserts that the string is not equal to the expected string, with an option to ignore case. ```APIDOC ## Assert.isNotEqualTo(other: String?, ignoreCase: Boolean = false) ### Description Asserts the string is not equal to the expected string. ### Method Extension Function ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```kotlin assertThat("hello").isNotEqualTo("world") assertThat("HELLO").isNotEqualTo("hello", ignoreCase = true) ``` ### Response #### Success Response (200) Assertion passes if the string is not equal to the expected string. #### Response Example N/A ```