diff --git a/pom.xml b/pom.xml index a07a5150..d144ccf9 100644 --- a/pom.xml +++ b/pom.xml @@ -50,12 +50,12 @@ 2.9.0 2.8.9 + 4.12.0 2.7 4.13.1 1.9.20 - 3.12.1 2.2.5 4.1.1.4 16 @@ -107,7 +107,6 @@ org.jetbrains.kotlin kotlin-stdlib-jdk8 ${kotlin.version} - test diff --git a/src/test/kotlin/com/contentful/java/cma/AssetTests.kt b/src/test/kotlin/com/contentful/java/cma/AssetTests.kt index ad69a703..3b5af40e 100644 --- a/src/test/kotlin/com/contentful/java/cma/AssetTests.kt +++ b/src/test/kotlin/com/contentful/java/cma/AssetTests.kt @@ -24,7 +24,7 @@ import com.contentful.java.cma.model.CMAAssetFile import com.contentful.java.cma.model.CMALink import com.contentful.java.cma.model.CMAType import com.google.gson.Gson -import okhttp3.HttpUrl +import okhttp3.HttpUrl.Companion.toHttpUrlOrNull import okhttp3.mockwebserver.MockResponse import okhttp3.mockwebserver.MockWebServer import org.junit.After @@ -235,7 +235,7 @@ class AssetTests { // Request val request = server!!.takeRequest() - val url = HttpUrl.parse(server!!.url(request.path).toString())!! + val url = server!!.url(request.path!!).toString().toHttpUrlOrNull()!! assertEquals("1", url.queryParameter("skip")) assertEquals("2", url.queryParameter("limit")) assertEquals("foo", url.queryParameter("content_type")) @@ -253,7 +253,7 @@ class AssetTests { // Request val request = server!!.takeRequest() - val url = HttpUrl.parse(server!!.url(request.path).toString())!! + val url = server!!.url(request.path!!).toString().toHttpUrlOrNull()!! assertEquals("1", url.queryParameter("skip")) assertEquals("2", url.queryParameter("limit")) assertEquals("foo", url.queryParameter("content_type")) @@ -435,7 +435,7 @@ class AssetTests { fun testRetainsSysOnNetworkError() { val badClient = CMAClient.Builder() .setAccessToken("accesstoken") - .setCoreCallFactory { throw IOException(it.url().toString(), IOException()) } + .setCoreCallFactory { throw IOException(it.url.toString(), IOException()) } .build() val asset = CMAAsset().setVersion(31337) diff --git a/src/test/kotlin/com/contentful/java/cma/CMAHttpExceptionTest.kt b/src/test/kotlin/com/contentful/java/cma/CMAHttpExceptionTest.kt index 7a4852df..add3409b 100644 --- a/src/test/kotlin/com/contentful/java/cma/CMAHttpExceptionTest.kt +++ b/src/test/kotlin/com/contentful/java/cma/CMAHttpExceptionTest.kt @@ -4,6 +4,8 @@ import com.contentful.java.cma.lib.TestUtils import com.contentful.java.cma.model.CMAHttpException import com.google.gson.Gson import okhttp3.* +import okhttp3.MediaType.Companion.toMediaTypeOrNull +import okhttp3.ResponseBody.Companion.toResponseBody import okhttp3.mockwebserver.MockWebServer import org.junit.After import org.junit.Before @@ -253,7 +255,7 @@ class CMAHttpExceptionTest { return Response.Builder() .request(request) .body( - ResponseBody.create(MediaType.parse("application/json"), body) + body.toResponseBody("application/json".toMediaTypeOrNull()) ) .header(HEADER_RATE_LIMIT_HOUR_LIMIT, "1") .header(HEADER_RATE_LIMIT_HOUR_REMAINING, "2") diff --git a/src/test/kotlin/com/contentful/java/cma/ClientTests.kt b/src/test/kotlin/com/contentful/java/cma/ClientTests.kt index 6cbf9fa1..d88fa619 100644 --- a/src/test/kotlin/com/contentful/java/cma/ClientTests.kt +++ b/src/test/kotlin/com/contentful/java/cma/ClientTests.kt @@ -96,7 +96,7 @@ class ClientTests{ fun testCoreCallbackRetrofitError() { val badClient = CMAClient.Builder() .setAccessToken("accesstoken") - .setCoreCallFactory { throw RuntimeException(it.url().toString(), IOException()) } + .setCoreCallFactory { throw RuntimeException(it.url.toString(), IOException()) } .build() val cb = TestCallback>() @@ -109,7 +109,7 @@ class ClientTests{ fun testUploadCallbackRetrofitError() { val badClient = CMAClient.Builder() .setAccessToken("accesstoken") - .setUploadCallFactory { throw RuntimeException(it.url().toString(), IOException()) } + .setUploadCallFactory { throw RuntimeException(it.url.toString(), IOException()) } .build() val cb = TestCallback() @@ -176,7 +176,7 @@ class ClientTests{ // Request val recordedRequest = server!!.takeRequest() - assertTrue(recordedRequest.getHeader("User-Agent").contains(versionName)) + assertTrue(recordedRequest.getHeader("User-Agent")!!.contains(versionName)) } @test @@ -188,7 +188,7 @@ class ClientTests{ // Request val recordedRequest = server!!.takeRequest() - val actual = recordedRequest.getHeader("X-Contentful-User-Agent") + val actual = recordedRequest.getHeader("X-Contentful-User-Agent")!! assertTrue(actual.contains("sdk contentful-management.java/")) assertTrue(actual.contains("platform java/")) assertTrue(actual.contains("os")) diff --git a/src/test/kotlin/com/contentful/java/cma/ContentTypeTests.kt b/src/test/kotlin/com/contentful/java/cma/ContentTypeTests.kt index 8168c3cc..b84e5d08 100644 --- a/src/test/kotlin/com/contentful/java/cma/ContentTypeTests.kt +++ b/src/test/kotlin/com/contentful/java/cma/ContentTypeTests.kt @@ -25,7 +25,7 @@ import com.contentful.java.cma.model.CMAField import com.contentful.java.cma.model.CMAHttpException import com.contentful.java.cma.model.CMAType import com.google.gson.Gson -import okhttp3.HttpUrl +import okhttp3.HttpUrl.Companion.toHttpUrlOrNull import okhttp3.mockwebserver.MockResponse import okhttp3.mockwebserver.MockWebServer import org.junit.After @@ -345,7 +345,7 @@ class ContentTypeTests{ // Request val request = server!!.takeRequest() - val url = HttpUrl.parse(server!!.url(request.path).toString())!! + val url = server!!.url(request.path!!).toString().toHttpUrlOrNull()!! assertEquals("1", url.queryParameter("skip")) assertEquals("2", url.queryParameter("limit")) assertEquals("bar", url.queryParameter("foo")) @@ -499,7 +499,7 @@ class ContentTypeTests{ fun testRetainsSysOnNetworkError() { val badClient = CMAClient.Builder() .setAccessToken("accesstoken") - .setCoreCallFactory { throw RuntimeException(it.url().toString(), IOException()) } + .setCoreCallFactory { throw RuntimeException(it.url.toString(), IOException()) } .build() val contentType = CMAContentType().setVersion(31337) diff --git a/src/test/kotlin/com/contentful/java/cma/EntryTests.kt b/src/test/kotlin/com/contentful/java/cma/EntryTests.kt index fbda024a..cf73a0ff 100644 --- a/src/test/kotlin/com/contentful/java/cma/EntryTests.kt +++ b/src/test/kotlin/com/contentful/java/cma/EntryTests.kt @@ -25,7 +25,7 @@ import com.contentful.java.cma.model.CMAMetadata import com.contentful.java.cma.model.CMATag import com.contentful.java.cma.model.CMAType import com.google.gson.Gson -import okhttp3.HttpUrl +import okhttp3.HttpUrl.Companion.toHttpUrlOrNull import okhttp3.mockwebserver.MockResponse import okhttp3.mockwebserver.MockWebServer import org.junit.After @@ -298,7 +298,7 @@ class EntryTests { // Request val request = server!!.takeRequest() - val url = HttpUrl.parse(server!!.url(request.path).toString())!! + val url = server!!.url(request.path!!).toString().toHttpUrlOrNull()!! assertEquals("1", url.queryParameter("skip")) assertEquals("2", url.queryParameter("limit")) assertEquals("foo", url.queryParameter("content_type")) @@ -452,7 +452,7 @@ class EntryTests { fun testRetainsSysOnNetworkError() { val badClient = CMAClient.Builder() .setAccessToken("accesstoken") - .setCoreCallFactory { throw RuntimeException(it.url().toString(), IOException()) } + .setCoreCallFactory { throw RuntimeException(it.url.toString(), IOException()) } .build() val entry = CMAEntry().setVersion(31337) diff --git a/src/test/kotlin/com/contentful/java/cma/ModelTests.kt b/src/test/kotlin/com/contentful/java/cma/ModelTests.kt index 3d968f69..0480c32c 100644 --- a/src/test/kotlin/com/contentful/java/cma/ModelTests.kt +++ b/src/test/kotlin/com/contentful/java/cma/ModelTests.kt @@ -159,7 +159,7 @@ class ModelTests { .build() assertEquals("FAILED \n" - + "\tRequest{method=GET, url=https://example.com/, tags={}}\n" + + "\tRequest{method=GET, url=https://example.com/}\n" + "\t↳ Header{}\n" + "\tResponse{" + "protocol=http/1.1, code=200, message=, url=https://example.com/}\n" diff --git a/src/test/kotlin/com/contentful/java/cma/WebhookTests.kt b/src/test/kotlin/com/contentful/java/cma/WebhookTests.kt index d8e68543..5a068660 100644 --- a/src/test/kotlin/com/contentful/java/cma/WebhookTests.kt +++ b/src/test/kotlin/com/contentful/java/cma/WebhookTests.kt @@ -289,7 +289,7 @@ class WebhookTests { fun testRetainsSysOnNetworkError() { val badClient = CMAClient.Builder() .setAccessToken("accesstoken") - .setCoreCallFactory { throw IOException(it.url().toString(), IOException()) } + .setCoreCallFactory { throw IOException(it.url.toString(), IOException()) } .build() val webhook = CMAWebhook().setVersion(31337) diff --git a/src/test/kotlin/com/contentful/java/cma/e2e/WebhookE2E.kt b/src/test/kotlin/com/contentful/java/cma/e2e/WebhookE2E.kt index ddfa983e..2d88c11b 100644 --- a/src/test/kotlin/com/contentful/java/cma/e2e/WebhookE2E.kt +++ b/src/test/kotlin/com/contentful/java/cma/e2e/WebhookE2E.kt @@ -198,7 +198,7 @@ open class WebhookE2E : Base() { fun testRetainsSysOnNetworkErrorWebhook() { val badClient = CMAClient.Builder() .setAccessToken("accesstoken") - .setCoreCallFactory { throw IOException(it.url().toString(), IOException()) } + .setCoreCallFactory { throw IOException(it.url.toString(), IOException()) } .build() val webhook = CMAWebhook().setVersion(31337)