fun String.shouldBeUUID(version: UUIDVersion = ANY, considerNilValid: Boolean = true): Unit
Asserts that this String is a valid UUID
Opposite of shouldNotBeUUID
Verifies that this string is a 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".shouldBeUUID(version = ANY) // Assertion passes
"123e4567-e89b-12d3-a456-426655440000".shouldBeUUID(version = V4) // Assertion Fails (is V1 UUID)
"123e4567e89b12d3a456426655440000".shouldBeUUID() // Assertion fails
"00000000-0000-0000-0000-000000000000".shouldBeUUID(considerNilValid = true) // Assertion passes
See Also