diff options
Diffstat (limited to 'tests/src/test/scala/com')
-rw-r--r-- | tests/src/test/scala/com/softwaremill/sttp/UriInterpolatorTests.scala | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/src/test/scala/com/softwaremill/sttp/UriInterpolatorTests.scala b/tests/src/test/scala/com/softwaremill/sttp/UriInterpolatorTests.scala new file mode 100644 index 0000000..57bb6af --- /dev/null +++ b/tests/src/test/scala/com/softwaremill/sttp/UriInterpolatorTests.scala @@ -0,0 +1,24 @@ +package com.softwaremill.sttp + +import java.net.URI + +import org.scalatest.{FlatSpec, Matchers} + +class UriInterpolatorTests extends FlatSpec with Matchers { + val v1 = "y" + val v2 = "a c" + val v2encoded = "a%20c" + + val testData: List[(URI, String)] = List( + (uri"http://example.com", "http://example.com"), + (uri"http://example.com?x=y", "http://example.com?x=y"), + (uri"http://example.com?x=$v1", s"http://example.com?x=$v1"), + (uri"http://example.com?x=$v2", s"http://example.com?x=$v2encoded") + ) + + for (((interpolated, expected), i) <- testData.zipWithIndex) { + it should s"interpolate to $expected ($i)" in { + interpolated should be (new URI(expected)) + } + } +} |