diff options
author | adamw <adam@warski.org> | 2017-07-08 21:27:52 +0200 |
---|---|---|
committer | adamw <adam@warski.org> | 2017-07-08 21:27:52 +0200 |
commit | 0863a2af75583b976aee3171585685b2524d0874 (patch) | |
tree | ee5d08849bfb78268715743b67caf3c3c223c50f /tests | |
parent | 8f03e817d315cda846136f04e85febf7022a1dc2 (diff) | |
download | sttp-0863a2af75583b976aee3171585685b2524d0874.tar.gz sttp-0863a2af75583b976aee3171585685b2524d0874.tar.bz2 sttp-0863a2af75583b976aee3171585685b2524d0874.zip |
Simple URI tests
Diffstat (limited to 'tests')
-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)) + } + } +} |