Created
March 7, 2017 15:15
-
-
Save jonas/6ccec6a28a105c89e3793b9f410b71ef to your computer and use it in GitHub Desktop.
JavaInitializerSpec
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git i/akka-http-core/src/test/scala/akka/http/javadsl/JavaInitializationSpec.scala w/akka-http-core/src/test/scala/akka/http/javadsl/JavaInitializationSpec.scala | |
index da49fcdfaf..9107486305 100644 | |
--- i/akka-http-core/src/test/scala/akka/http/javadsl/JavaInitializationSpec.scala | |
+++ w/akka-http-core/src/test/scala/akka/http/javadsl/JavaInitializationSpec.scala | |
@@ -8,12 +8,21 @@ import org.scalatest.{ Matchers, WordSpec } | |
class JavaInitializationSpec extends WordSpec with Matchers { | |
+ implicit class HeaderCheck[T](self: T) { | |
+ def =!=(expected: String) = self.toString shouldBe expected | |
+ } | |
+ | |
"LanguageRange" should { | |
"initializes the right field" in { | |
- akka.http.scaladsl.model.headers.LanguageRange.`*` // first we touch the scala one, it should force init the Java one | |
- val _ = akka.http.javadsl.model.headers.LanguageRange.ALL // touching this one should not fail | |
- akka.http.javadsl.model.headers.LanguageRanges.ALL // this is recommended and should work well too | |
+ // Uncommenting the following line fixes the NPE | |
+ // akka.http.javadsl.model.headers.HttpOriginRange.ALL =!= "*" | |
+ akka.http.scaladsl.model.headers.HttpOriginRange.`*` =!= "*" | |
+ | |
+ akka.http.scaladsl.model.headers.LanguageRange.`*` =!= "*" // first we touch the scala one, it should force init the Java one | |
+ akka.http.javadsl.model.headers.AccessControlAllowOrigin.create(akka.http.javadsl.model.headers.HttpOriginRange.ALL) =!= "Access-Control-Allow-Origin: *" | |
+ akka.http.javadsl.model.headers.LanguageRange.ALL =!= "*" // touching this one should not fail | |
+ akka.http.javadsl.model.headers.LanguageRanges.ALL =!= "*" // this is recommended and should work well too | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[info] LanguageRange | |
[info] - should initializes the right field *** FAILED *** | |
[info] java.lang.NullPointerException: | |
[info] at akka.http.impl.util.Renderer$RenderableRenderer$.render(Rendering.scala:109) | |
[info] at akka.http.impl.util.Renderer$RenderableRenderer$.render(Rendering.scala:108) | |
[info] at akka.http.impl.util.Rendering$class.$tilde$tilde(Rendering.scala:194) | |
[info] at akka.http.impl.util.StringRendering.$tilde$tilde(Rendering.scala:238) | |
[info] at akka.http.scaladsl.model.headers.Access$minusControl$minusAllow$minusOrigin.renderValue(headers.scala:258) | |
[info] at akka.http.scaladsl.model.headers.ModeledHeader$class.render(headers.scala:64) | |
[info] at akka.http.scaladsl.model.headers.Access$minusControl$minusAllow$minusOrigin.render(headers.scala:256) | |
[info] at akka.http.impl.util.ToStringRenderable$class.toString(Rendering.scala:37) | |
[info] at akka.http.scaladsl.model.HttpHeader.toString(HttpHeader.scala:27) | |
[info] at akka.http.javadsl.JavaInitializationSpec$HeaderCheck.$eq$bang$eq(JavaInitializationSpec.scala:12) | |
[info] ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment