kotest-assertions-core / io.kotest.matchers.string / kotlin.String / shouldNotBeUUID

shouldNotBeUUID

fun String.shouldNotBeUUID(version: UUIDVersion = ANY, considerNilValid: Boolean = true): Unit

Asserts that this String is NOT a valid UUID

Opposite of shouldBeUUID

Verifies that this string is a NOT valid UUID as per RFC4122. Version depends on version. By default, all versions (v1 through v5) are matched. A special attention is necessary for the NIL UUID (an UUID with all zeros), which is considered a valid UUID. By default it's matched as valid.

"123e4567-e89b-12d3-a456-426655440000".shouldNotBeUUID(version = ANY)  // Assertion fails
"123e4567e89b12d3a456426655440000".shouldNotBeUUID()      // Assertion passes
"00000000-0000-0000-0000-000000000000".shouldNotBeUUID(considerNilValid = true)  // Assertion fails

See Also

RFC4122