=htp stop case class extraction from throwing IllegalArgumentException

This commit is contained in:
Anderson Osagie 2015-12-13 12:38:44 -05:00 committed by Konrad Malawski
parent 000630c036
commit d4ad6ea885
2 changed files with 26 additions and 1 deletions

View file

@ -119,6 +119,17 @@ class BasicRouteSpecs extends RoutingSpec {
responseAs[String] shouldEqual "Person(john,38)"
}
}
"reject if case class requirements fail" in {
case class MyValidNumber(i: Int) {
require(i > 10)
}
val abcPath = path("abc" / IntNumber).as(MyValidNumber)(echoComplete)
Get("/abc/5") ~> abcPath ~> check {
rejection shouldBe a[ValidationRejection]
}
}
}
"Dynamic execution of inner routes of Directive0" should {
"re-execute inner routes every time" in {