=str,htp clean up build warnings

- explicitly provide Unit values and place parens around tuple creation
- remove structural type usage in TestUtils
- fix Java double-casts
- use unused Java values by asserting their non-nullness
- work around inability to place case class in trait (scripted test)

The remaining warnings about using private types in public methods are
bogus as reported in https://issues.scala-lang.org/browse/SI-9490.
This commit is contained in:
Roland Kuhn 2015-09-25 12:51:55 +02:00
parent ae83053a64
commit 68ba0643d6
58 changed files with 160 additions and 132 deletions

View file

@ -146,7 +146,7 @@ class CacheConditionDirectivesSpec extends RoutingSpec {
"not filter out a `Range` header if `If-Range` does match the timestamp" in {
Get() ~> `If-Range`(timestamp) ~> Range(ByteRange(0, 10)) ~> {
(conditional(tag, timestamp) & optionalHeaderValueByType[Range]()) { echoComplete }
(conditional(tag, timestamp) & optionalHeaderValueByType[Range](())) { echoComplete }
} ~> check {
status shouldEqual OK
responseAs[String] should startWith("Some")
@ -155,7 +155,7 @@ class CacheConditionDirectivesSpec extends RoutingSpec {
"filter out a `Range` header if `If-Range` doesn't match the timestamp" in {
Get() ~> `If-Range`(timestamp - 1000) ~> Range(ByteRange(0, 10)) ~> {
(conditional(tag, timestamp) & optionalHeaderValueByType[Range]()) { echoComplete }
(conditional(tag, timestamp) & optionalHeaderValueByType[Range](())) { echoComplete }
} ~> check {
status shouldEqual OK
responseAs[String] shouldEqual "None"
@ -164,7 +164,7 @@ class CacheConditionDirectivesSpec extends RoutingSpec {
"not filter out a `Range` header if `If-Range` does match the ETag" in {
Get() ~> `If-Range`(tag) ~> Range(ByteRange(0, 10)) ~> {
(conditional(tag, timestamp) & optionalHeaderValueByType[Range]()) { echoComplete }
(conditional(tag, timestamp) & optionalHeaderValueByType[Range](())) { echoComplete }
} ~> check {
status shouldEqual OK
responseAs[String] should startWith("Some")
@ -173,7 +173,7 @@ class CacheConditionDirectivesSpec extends RoutingSpec {
"filter out a `Range` header if `If-Range` doesn't match the ETag" in {
Get() ~> `If-Range`(EntityTag("other")) ~> Range(ByteRange(0, 10)) ~> {
(conditional(tag, timestamp) & optionalHeaderValueByType[Range]()) { echoComplete }
(conditional(tag, timestamp) & optionalHeaderValueByType[Range](())) { echoComplete }
} ~> check {
status shouldEqual OK
responseAs[String] shouldEqual "None"

View file

@ -14,7 +14,7 @@ class ExecutionDirectivesSpec extends RoutingSpec {
object MyException extends RuntimeException
val handler =
ExceptionHandler {
case MyException complete(500, "Pling! Plong! Something went wrong!!!")
case MyException complete((500, "Pling! Plong! Something went wrong!!!"))
}
"The `handleExceptions` directive" should {

View file

@ -16,7 +16,7 @@ class FutureDirectivesSpec extends RoutingSpec {
def throwTestException[T](msgPrefix: String): T Nothing = t throw new TestException(msgPrefix + t)
implicit val exceptionHandler = ExceptionHandler {
case e: TestException complete(StatusCodes.InternalServerError, "Oops. " + e)
case e: TestException complete((StatusCodes.InternalServerError, "Oops. " + e))
}
"The `onComplete` directive" should {
@ -39,13 +39,13 @@ class FutureDirectivesSpec extends RoutingSpec {
"catch an exception in the success case" in {
Get() ~> onComplete(Future.successful("ok")) { throwTestException("EX when ") } ~> check {
status shouldEqual StatusCodes.InternalServerError
responseAs[String] shouldEqual "Oops. akka.http.scaladsl.server.directives.FutureDirectivesSpec$TestException: EX when Success(ok)"
responseAs[String] shouldEqual s"Oops. akka.http.scaladsl.server.directives.FutureDirectivesSpec$$TestException: EX when Success(ok)"
}
}
"catch an exception in the failure case" in {
Get() ~> onComplete(Future.failed[String](new RuntimeException("no"))) { throwTestException("EX when ") } ~> check {
status shouldEqual StatusCodes.InternalServerError
responseAs[String] shouldEqual "Oops. akka.http.scaladsl.server.directives.FutureDirectivesSpec$TestException: EX when Failure(java.lang.RuntimeException: no)"
responseAs[String] shouldEqual s"Oops. akka.http.scaladsl.server.directives.FutureDirectivesSpec$$TestException: EX when Failure(java.lang.RuntimeException: no)"
}
}
}
@ -64,7 +64,7 @@ class FutureDirectivesSpec extends RoutingSpec {
"catch an exception in the success case" in {
Get() ~> onSuccess(Future.successful("ok")) { throwTestException("EX when ") } ~> check {
status shouldEqual StatusCodes.InternalServerError
responseAs[String] shouldEqual "Oops. akka.http.scaladsl.server.directives.FutureDirectivesSpec$TestException: EX when ok"
responseAs[String] shouldEqual s"Oops. akka.http.scaladsl.server.directives.FutureDirectivesSpec$$TestException: EX when ok"
}
}
"catch an exception in the failure case" in {
@ -99,7 +99,7 @@ class FutureDirectivesSpec extends RoutingSpec {
"catch an exception during recovery" in {
Get() ~> completeOrRecoverWith(Future.failed[String](TestException)) { throwTestException("EX when ") } ~> check {
status shouldEqual StatusCodes.InternalServerError
responseAs[String] shouldEqual "Oops. akka.http.scaladsl.server.directives.FutureDirectivesSpec$TestException: EX when akka.http.scaladsl.server.directives.FutureDirectivesSpec$TestException$: XXX"
responseAs[String] shouldEqual s"Oops. akka.http.scaladsl.server.directives.FutureDirectivesSpec$$TestException: EX when akka.http.scaladsl.server.directives.FutureDirectivesSpec$$TestException$$: XXX"
}
}
}

View file

@ -21,9 +21,9 @@ class TupleOpsSpec extends WordSpec with Matchers {
}
"support joining tuples" in {
(1, 'X2, "3") join () shouldEqual (1, 'X2, "3")
() join (1, 'X2, "3") shouldEqual (1, 'X2, "3")
(1, 'X2, "3") join (4.0, 5L) shouldEqual (1, 'X2, "3", 4.0, 5L)
(1, 'X2, "3") join (()) shouldEqual ((1, 'X2, "3"))
() join ((1, 'X2, "3")) shouldEqual ((1, 'X2, "3"))
(1, 'X2, "3") join ((4.0, 5L)) shouldEqual ((1, 'X2, "3", 4.0, 5L))
}
}
}