Official Document :
" Accord supports several native Scala control structures, notably ifs and pattern matching "
in http://wix.github.io/accord/dsl.html
case class InputData(
id: String,
name: Option[String] = None,
description: Option[String] = None,
items: Seq[String] = Seq.empty
)
Unit Test :
val data = InputData("", None, None, Seq.empty)
val result = validate(data)
result.isFailure shouldBe true
result.toFailure.value.violations.size shouldBe 4
Test Compilation Failed !
implicit val inputDataValidator: Validator[InputData] = validator[InputData] { request =>
request.name match {
case Some(value) => {
request.id is notBlank
request.name.mkString is notBlank
request.description.mkString is equalTo(value)
request.items is notEmpty
}
case None =>
}
()
}
Test Compilation Error :
[error] not found: value value
[error] request.description.mkString is equalTo(value)
[error] ^
[error] one error found
Official Document : " Accord supports several native Scala control structures, notably ifs and pattern matching " in http://wix.github.io/accord/dsl.html
Library Dependencies :
Input Data :
Unit Test :
Test Compilation Failed !
Test Compilation Error :