Skip to content

Instantly share code, notes, and snippets.

@jaimedantas
Created April 1, 2021 00:06
Show Gist options
  • Save jaimedantas/982c4e30a0055a1613b78389c81fb618 to your computer and use it in GitHub Desktop.
Save jaimedantas/982c4e30a0055a1613b78389c81fb618 to your computer and use it in GitHub Desktop.
@MicronautTest
internal class ResourceValidatorTest{
@Test
internal fun shouldValidadeIdAsInvalidUUID() {
val validator: Validator<Resource> = ResourceValidator()
val resource: Resource = Resource("invalidId")
val result: ValidationResult = validator.validate(resource)
assertFalse(result.isValid())
assertFalse(result.getErrors().isEmpty());
}
@Test
internal fun shouldValidateIdAsValidUUID() {
val validator: Validator<Resource> = ResourceValidator()
val resource = Resource(UUID.randomUUID().toString())
val result: ValidationResult = validator.validate(resource)
assertTrue(result.isValid())
assertTrue(result.getErrors().isEmpty());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment