From cbe55be15a81f31afcd12ad47abe8fa780227f85 Mon Sep 17 00:00:00 2001 From: Kittinun Vantasin Date: Sun, 6 Sep 2020 01:15:12 +0900 Subject: [PATCH] :arrow_up: [Update] Upgrade dependencies and small fixes (#31) --- build.gradle.kts | 4 +- .../com/github/kittinunf/forge/Forge.kt | 8 +- .../kittinunf/forge/core/Deserializable.kt | 2 +- .../github/kittinunf/forge/core/ForgeError.kt | 2 +- .../com/github/kittinunf/forge/core/JSON.kt | 14 +-- .../github/kittinunf/forge/core/Operators.kt | 16 ++-- .../kittinunf/forge/core/Serializable.kt | 2 +- .../forge/deserializer/DateDeserializer.kt | 10 +-- .../forge/deserializer/JSONDeserializer.kt | 4 +- .../kittinunf/forge/extension/JSONArrayExt.kt | 2 +- .../forge/extension/JSONObjectExt.kt | 2 +- .../github/kittinunf/forge/CurryingTest.kt | 1 - .../kittinunf/forge/JSONMappingArrayTest.kt | 38 ++++---- .../kittinunf/forge/JSONMappingObjectTest.kt | 86 +++++++++---------- .../github/kittinunf/forge/JSONObjectTest.kt | 18 ++-- .../kittinunf/forge/ParsingErrorTest.kt | 37 ++++---- gradle.properties | 11 +-- 17 files changed, 129 insertions(+), 128 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index c76135c..f758d38 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,8 +2,8 @@ import org.gradle.api.internal.artifacts.dsl.LazyPublishArtifact import org.jmailen.gradle.kotlinter.support.ReporterType plugins { - kotlin("jvm") version "1.3.60" - id("org.jmailen.kotlinter") version "2.3.0" + kotlin("jvm") version "1.4.0" + id("org.jmailen.kotlinter") version "3.0.2" jacoco `maven-publish` diff --git a/forge/src/main/kotlin/com/github/kittinunf/forge/Forge.kt b/forge/src/main/kotlin/com/github/kittinunf/forge/Forge.kt index 3d7ec7a..eeeefec 100644 --- a/forge/src/main/kotlin/com/github/kittinunf/forge/Forge.kt +++ b/forge/src/main/kotlin/com/github/kittinunf/forge/Forge.kt @@ -10,14 +10,14 @@ import org.json.JSONObject object Forge { fun > modelFromJson(json: String, deserializer: U): DeserializedResult = - deserializer.deserialize(JSON.parse(JSONObject(json))) + deserializer.deserialize(JSON.parse(JSONObject(json))) fun modelFromJson(json: String, deserializer: JSON.() -> DeserializedResult): DeserializedResult = - JSON.parse(JSONObject(json)).deserializer() + JSON.parse(JSONObject(json)).deserializer() fun > modelsFromJson(json: String, deserializer: U): DeserializedResult> = - JSON.parse(JSONArray(json)).toList().map(deserializer::deserialize).lift() + JSON.parse(JSONArray(json)).toList().map(deserializer::deserialize).lift() fun modelsFromJson(json: String, deserializer: JSON.() -> DeserializedResult): DeserializedResult> = - JSON.parse(JSONArray(json)).toList().map(deserializer).lift() + JSON.parse(JSONArray(json)).toList().map(deserializer).lift() } diff --git a/forge/src/main/kotlin/com/github/kittinunf/forge/core/Deserializable.kt b/forge/src/main/kotlin/com/github/kittinunf/forge/core/Deserializable.kt index 8771f79..21b71d5 100644 --- a/forge/src/main/kotlin/com/github/kittinunf/forge/core/Deserializable.kt +++ b/forge/src/main/kotlin/com/github/kittinunf/forge/core/Deserializable.kt @@ -3,4 +3,4 @@ package com.github.kittinunf.forge.core interface Deserializable { fun deserialize(json: JSON): DeserializedResult -} \ No newline at end of file +} diff --git a/forge/src/main/kotlin/com/github/kittinunf/forge/core/ForgeError.kt b/forge/src/main/kotlin/com/github/kittinunf/forge/core/ForgeError.kt index f541f46..bf7ad71 100644 --- a/forge/src/main/kotlin/com/github/kittinunf/forge/core/ForgeError.kt +++ b/forge/src/main/kotlin/com/github/kittinunf/forge/core/ForgeError.kt @@ -5,4 +5,4 @@ sealed class ForgeError(message: String) : Exception(message) class MissingAttributeError(val key: String) : ForgeError("Attribute is Missing - key \"$key\" is not found") class AttributeTypeInvalidError(val key: String, val expectedClass: Class<*>, val receivedValue: Any) : - ForgeError("Attribute Type Invalid - key: \"$key\", expected type: $expectedClass, received value: ${if (receivedValue is String) "\"$receivedValue\"" else receivedValue}") + ForgeError("Attribute Type Invalid - key: \"$key\", expected type: $expectedClass, received value: ${if (receivedValue is String) "\"$receivedValue\"" else receivedValue}") diff --git a/forge/src/main/kotlin/com/github/kittinunf/forge/core/JSON.kt b/forge/src/main/kotlin/com/github/kittinunf/forge/core/JSON.kt index 2600cd1..38d304a 100644 --- a/forge/src/main/kotlin/com/github/kittinunf/forge/core/JSON.kt +++ b/forge/src/main/kotlin/com/github/kittinunf/forge/core/JSON.kt @@ -45,12 +45,14 @@ sealed class JSON : Sequence { is JSONObject -> return parse(toMap(json)) is JSONArray -> return parse(toList(json)) - is Map<*, *> -> return Object((json as Map).asSequence().fold(mutableMapOf()) { accum, entry -> - val (key, value) = entry - val jsonValue = parse(value) - accum += key to jsonValue - accum - }) + is Map<*, *> -> return Object( + (json as Map).asSequence().fold(mutableMapOf()) { accum, entry -> + val (key, value) = entry + val jsonValue = parse(value) + accum += key to jsonValue + accum + } + ) is List<*> -> return Array(json.map { parse(it!!) }) diff --git a/forge/src/main/kotlin/com/github/kittinunf/forge/core/Operators.kt b/forge/src/main/kotlin/com/github/kittinunf/forge/core/Operators.kt index 02cd732..3ab1a4a 100644 --- a/forge/src/main/kotlin/com/github/kittinunf/forge/core/Operators.kt +++ b/forge/src/main/kotlin/com/github/kittinunf/forge/core/Operators.kt @@ -12,27 +12,27 @@ infix fun Function1.map(result: DeserializedResult) = result.map fun DeserializedResult<(T) -> U>.apply(result: DeserializedResult): DeserializedResult = flatMap(result::map) inline infix fun JSON.at(key: String): DeserializedResult = - at(key, deserializer = { deserializeAs(key) }) + at(key, deserializer = { deserializeAs(key) }) inline infix fun JSON.maybeAt(key: String): DeserializedResult = - maybeAt(key, deserializer = { deserializeAs(key) }) + maybeAt(key, deserializer = { deserializeAs(key) }) fun JSON.at(key: String, deserializer: JSON.() -> DeserializedResult): DeserializedResult = - find(key)?.deserializer() ?: Failure(MissingAttributeError(key)) + find(key)?.deserializer() ?: Failure(MissingAttributeError(key)) @Suppress("UNCHECKED_CAST") fun JSON.maybeAt(key: String, deserializer: JSON.() -> DeserializedResult): DeserializedResult = - find(key)?.deserializer() ?: Success(null) as DeserializedResult + find(key)?.deserializer() ?: Success(null) as DeserializedResult inline infix fun JSON.list(key: String): DeserializedResult> = - list(key, deserializer = { deserializeAs(key) }) + list(key, deserializer = { deserializeAs(key) }) inline infix fun JSON.maybeList(key: String): DeserializedResult> = - maybeList(key, deserializer = { deserializeAs(key) }) + maybeList(key, deserializer = { deserializeAs(key) }) fun JSON.list(key: String, deserializer: JSON.() -> DeserializedResult): DeserializedResult> = - find(key)?.map(deserializer)?.toList()?.lift() ?: Failure(MissingAttributeError(key)) + find(key)?.map(deserializer)?.toList()?.lift() ?: Failure(MissingAttributeError(key)) @Suppress("UNCHECKED_CAST") fun JSON.maybeList(key: String, deserializer: JSON.() -> DeserializedResult): DeserializedResult> = - find(key)?.map(deserializer)?.toList()?.lift() ?: Success(null) as DeserializedResult> + find(key)?.map(deserializer)?.toList()?.lift() ?: Success(null) as DeserializedResult> diff --git a/forge/src/main/kotlin/com/github/kittinunf/forge/core/Serializable.kt b/forge/src/main/kotlin/com/github/kittinunf/forge/core/Serializable.kt index fee887d..7ea8375 100644 --- a/forge/src/main/kotlin/com/github/kittinunf/forge/core/Serializable.kt +++ b/forge/src/main/kotlin/com/github/kittinunf/forge/core/Serializable.kt @@ -3,4 +3,4 @@ package com.github.kittinunf.forge.core interface Serializable { fun serialize(): JSON -} \ No newline at end of file +} diff --git a/forge/src/main/kotlin/com/github/kittinunf/forge/deserializer/DateDeserializer.kt b/forge/src/main/kotlin/com/github/kittinunf/forge/deserializer/DateDeserializer.kt index 577db70..1a5de66 100644 --- a/forge/src/main/kotlin/com/github/kittinunf/forge/deserializer/DateDeserializer.kt +++ b/forge/src/main/kotlin/com/github/kittinunf/forge/deserializer/DateDeserializer.kt @@ -14,9 +14,9 @@ fun toDate(style: String = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"): (String) -> Date = { } fun JSON.deserializeDate(key: String, style: String = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'"): DeserializedResult = - when (this) { - is JSON.String -> { - Success(toDate(style).invoke(value)) - } - else -> Failure(AttributeTypeInvalidError(key, javaClass, value)) + when (this) { + is JSON.String -> { + Success(toDate(style).invoke(value)) } + else -> Failure(AttributeTypeInvalidError(key, javaClass, value)) + } diff --git a/forge/src/main/kotlin/com/github/kittinunf/forge/deserializer/JSONDeserializer.kt b/forge/src/main/kotlin/com/github/kittinunf/forge/deserializer/JSONDeserializer.kt index 7cec7c5..31ab6f1 100644 --- a/forge/src/main/kotlin/com/github/kittinunf/forge/deserializer/JSONDeserializer.kt +++ b/forge/src/main/kotlin/com/github/kittinunf/forge/deserializer/JSONDeserializer.kt @@ -7,9 +7,9 @@ import com.github.kittinunf.forge.core.JSON.Null import com.github.kittinunf.result.Result.Failure import com.github.kittinunf.result.Result.Success -inline fun JSON.deserializeAs(key: String? = null): DeserializedResult = when (this) { +inline fun JSON.deserializeAs(key: String): DeserializedResult = when (this) { is Null -> Success(null as T) else -> { - (value as? T)?.let(::Success) ?: Failure(AttributeTypeInvalidError(key ?: "(null)", T::class.java, value)) + (value as? T)?.let { Success(it) } ?: Failure(AttributeTypeInvalidError(key, T::class.java, value)) } } diff --git a/forge/src/main/kotlin/com/github/kittinunf/forge/extension/JSONArrayExt.kt b/forge/src/main/kotlin/com/github/kittinunf/forge/extension/JSONArrayExt.kt index e72ef0b..b6f092a 100644 --- a/forge/src/main/kotlin/com/github/kittinunf/forge/extension/JSONArrayExt.kt +++ b/forge/src/main/kotlin/com/github/kittinunf/forge/extension/JSONArrayExt.kt @@ -17,4 +17,4 @@ fun JSONArray.asSequence(): Sequence { override fun hasNext() = it.hasNext() } } -} \ No newline at end of file +} diff --git a/forge/src/main/kotlin/com/github/kittinunf/forge/extension/JSONObjectExt.kt b/forge/src/main/kotlin/com/github/kittinunf/forge/extension/JSONObjectExt.kt index 484544e..94acaeb 100644 --- a/forge/src/main/kotlin/com/github/kittinunf/forge/extension/JSONObjectExt.kt +++ b/forge/src/main/kotlin/com/github/kittinunf/forge/extension/JSONObjectExt.kt @@ -18,4 +18,4 @@ fun JSONObject.asSequence(): Sequence> { override fun hasNext() = it.hasNext() } } -} \ No newline at end of file +} diff --git a/forge/src/test/kotlin/com/github/kittinunf/forge/CurryingTest.kt b/forge/src/test/kotlin/com/github/kittinunf/forge/CurryingTest.kt index b3a1931..3239dd4 100644 --- a/forge/src/test/kotlin/com/github/kittinunf/forge/CurryingTest.kt +++ b/forge/src/test/kotlin/com/github/kittinunf/forge/CurryingTest.kt @@ -10,7 +10,6 @@ import com.github.kittinunf.forge.model.User import com.github.kittinunf.forge.model.UserWithOptionalFields import com.github.kittinunf.forge.util.create import com.github.kittinunf.forge.util.curry - import org.hamcrest.CoreMatchers.equalTo import org.hamcrest.CoreMatchers.nullValue import org.hamcrest.MatcherAssert.assertThat diff --git a/forge/src/test/kotlin/com/github/kittinunf/forge/JSONMappingArrayTest.kt b/forge/src/test/kotlin/com/github/kittinunf/forge/JSONMappingArrayTest.kt index 5ce2396..0a07493 100644 --- a/forge/src/test/kotlin/com/github/kittinunf/forge/JSONMappingArrayTest.kt +++ b/forge/src/test/kotlin/com/github/kittinunf/forge/JSONMappingArrayTest.kt @@ -25,28 +25,28 @@ class JSONMappingArrayTest : BaseTest() { class UserDeserializer : Deserializable { override fun deserialize(json: JSON): DeserializedResult { return ::User.create - .map(json at "id") - .apply(json at "username") - .apply(json at "name") - .apply(json at "age") - .apply(json at "email") - .apply(json maybeList "levels") - .apply(json.maybeAt("friend", FriendDeserializer()::deserialize)) + .map(json at "id") + .apply(json at "username") + .apply(json at "name") + .apply(json at "age") + .apply(json at "email") + .apply(json maybeList "levels") + .apply(json.maybeAt("friend", FriendDeserializer()::deserialize)) } } val companyDeserializer = { json: JSON -> ::Company.create - .map(json at "name") - .apply(json at "catch_phrase") + .map(json at "name") + .apply(json at "catch_phrase") } val userModelWithCompany = { json: JSON -> ::UserWithCompany.create - .map(json at "id") - .apply(json at "username") - .apply(json maybeAt "is_deleted") - .apply(json.at("company", companyDeserializer)) + .map(json at "id") + .apply(json at "username") + .apply(json maybeAt "is_deleted") + .apply(json.at("company", companyDeserializer)) } @Test @@ -74,16 +74,16 @@ class JSONMappingArrayTest : BaseTest() { val dogDeserializer = { j: JSON -> ::Dog.create - .map(j at "name") - .apply(j at "breed") - .apply(j at "is_male") + .map(j at "name") + .apply(j at "breed") + .apply(j at "is_male") } val userWithDogDeserializer = { j: JSON -> ::UserWithDogs.create - .map(j at "email") - .apply(j at "phone") - .apply(j.maybeList("dogs", dogDeserializer)) + .map(j at "email") + .apply(j at "phone") + .apply(j.maybeList("dogs", dogDeserializer)) } @Test diff --git a/forge/src/test/kotlin/com/github/kittinunf/forge/JSONMappingObjectTest.kt b/forge/src/test/kotlin/com/github/kittinunf/forge/JSONMappingObjectTest.kt index aa64016..eb66b80 100644 --- a/forge/src/test/kotlin/com/github/kittinunf/forge/JSONMappingObjectTest.kt +++ b/forge/src/test/kotlin/com/github/kittinunf/forge/JSONMappingObjectTest.kt @@ -31,9 +31,9 @@ class JSONMappingObjectTest : BaseTest() { class SimpleUserDeserializer : Deserializable { override fun deserialize(json: JSON): DeserializedResult = - ::SimpleUser.create - .map(json at "id") - .apply(json at "name") + ::SimpleUser.create + .map(json at "id") + .apply(json at "name") } @Test @@ -48,14 +48,14 @@ class JSONMappingObjectTest : BaseTest() { class UserDeserializer : Deserializable { override fun deserialize(json: JSON): DeserializedResult = - ::User.create - .map(json at "id") - .apply(json at "username") - .apply(json at "name") - .apply(json at "age") - .apply(json at "email") - .apply(json list "levels") - .apply(json.at("friend", FriendDeserializer()::deserialize)) + ::User.create + .map(json at "id") + .apply(json at "username") + .apply(json at "name") + .apply(json at "age") + .apply(json at "email") + .apply(json list "levels") + .apply(json.at("friend", FriendDeserializer()::deserialize)) } @Test @@ -84,16 +84,16 @@ class JSONMappingObjectTest : BaseTest() { val companyDeserializer = { json: JSON -> ::Company.create - .map(json at "name") - .apply(json at "catch_phrase") + .map(json at "name") + .apply(json at "catch_phrase") } val userModelWithCompanyDeserializer = { json: JSON -> ::UserWithCompany.create - .map(json at "id") - .apply(json at "username") - .apply(json at "is_deleted") - .apply(json.at("company", companyDeserializer)) + .map(json at "id") + .apply(json at "username") + .apply(json at "is_deleted") + .apply(json.at("company", companyDeserializer)) } @Test @@ -111,17 +111,17 @@ class JSONMappingObjectTest : BaseTest() { class UserCreatedAt1Deserializer : Deserializable { override fun deserialize(json: JSON): DeserializedResult = - ::UserCreatedAt.create - .map(json at "id") - .apply(json.at("created_at", deserializer = { deserializeDate("created_at") })) + ::UserCreatedAt.create + .map(json at "id") + .apply(json.at("created_at", deserializer = { deserializeDate("created_at") })) } class UserCreatedAt2Deserializer : Deserializable { override fun deserialize(json: JSON): DeserializedResult = - ::UserCreatedAt.create - .map(json at "id") - .apply(toDate() map (json at "created_at")) + ::UserCreatedAt.create + .map(json at "id") + .apply(toDate() map (json at "created_at")) } @Test @@ -168,12 +168,12 @@ class JSONMappingObjectTest : BaseTest() { class UserWithOptionalFieldsDeserializer : Deserializable { override fun deserialize(json: JSON): DeserializedResult = - ::UserWithOptionalFields.create - .map(json at "name") - .apply(json maybeAt "city") - .apply(json maybeAt "gender") - .apply(json at "phone") - .apply(json at "weight") + ::UserWithOptionalFields.create + .map(json at "name") + .apply(json maybeAt "city") + .apply(json maybeAt "gender") + .apply(json at "phone") + .apply(json at "weight") } @Test @@ -191,28 +191,28 @@ class JSONMappingObjectTest : BaseTest() { class AddressDeserializer : Deserializable { override fun deserialize(json: JSON): DeserializedResult = - ::Address.create - .map(json at "street") - .apply(json at "suite") - .apply(json at "city") + ::Address.create + .map(json at "street") + .apply(json at "suite") + .apply(json at "city") } class FriendDeserializer : Deserializable { override fun deserialize(json: JSON): DeserializedResult = - ::Friend.create - .map(json at "id") - .apply(json at "name") - .apply(json.at("address", AddressDeserializer()::deserialize)) + ::Friend.create + .map(json at "id") + .apply(json at "name") + .apply(json.at("address", AddressDeserializer()::deserialize)) } class UserWithFriendsDeserializer : Deserializable { override fun deserialize(json: JSON): DeserializedResult = - ::UserWithFriends.create - .map(json at "id") - .apply(json at "name") - .apply(json at "age") - .apply(json at "email") - .apply(json.list("friends", FriendDeserializer()::deserialize)) + ::UserWithFriends.create + .map(json at "id") + .apply(json at "name") + .apply(json at "age") + .apply(json at "email") + .apply(json.list("friends", FriendDeserializer()::deserialize)) } @Test diff --git a/forge/src/test/kotlin/com/github/kittinunf/forge/JSONObjectTest.kt b/forge/src/test/kotlin/com/github/kittinunf/forge/JSONObjectTest.kt index 44d905c..04d7b0e 100644 --- a/forge/src/test/kotlin/com/github/kittinunf/forge/JSONObjectTest.kt +++ b/forge/src/test/kotlin/com/github/kittinunf/forge/JSONObjectTest.kt @@ -31,26 +31,26 @@ class JSONObjectTest : BaseTest() { fun testJSONValidValue() { val json = JSON.parse((JSONObject(userJson))) - val id = json.find("id")?.deserializeAs() + val id = json.find("id")?.deserializeAs("") assertThat(id, notNullValue()) assertThat(id!!.get(), equalTo(1)) - val name = json.find("name")?.deserializeAs() + val name = json.find("name")?.deserializeAs("") assertThat(name, notNullValue()) assertThat(name!!.get(), equalTo("Clementina DuBuque")) - val isDeleted = json.find("is_deleted")?.deserializeAs() + val isDeleted = json.find("is_deleted")?.deserializeAs("") assertThat(isDeleted, notNullValue()) assertThat(isDeleted!!.get(), equalTo(true)) - val addressStreet = json.find("address.street")?.deserializeAs() + val addressStreet = json.find("address.street")?.deserializeAs("") assertThat(addressStreet, notNullValue()) assertThat(addressStreet!!.get(), equalTo("Kattie Turnpike")) - val addressGeoLat = json.find("address.geo.lat")?.deserializeAs() + val addressGeoLat = json.find("address.geo.lat")?.deserializeAs("") assertThat(addressGeoLat, notNullValue()) assertThat(addressGeoLat!!.get(), equalTo(-38.2386)) @@ -60,14 +60,14 @@ class JSONObjectTest : BaseTest() { fun testJSONInvalidValue() { val json = JSON.parse((JSONObject(userJson))) - val notFoundName = json.find("n")?.deserializeAs() - ?: Failure(MissingAttributeError("n")) + val notFoundName = json.find("n")?.deserializeAs("") + ?: Failure(MissingAttributeError("n")) assertThat(notFoundName, notNullValue()) assertThat((notFoundName as Failure).error, instanceOf(MissingAttributeError::class.java)) - val notFoundAddressSt = json.find("address.st")?.deserializeAs() - ?: Failure(MissingAttributeError("address.st")) + val notFoundAddressSt = json.find("address.st")?.deserializeAs("") + ?: Failure(MissingAttributeError("address.st")) assertThat(notFoundAddressSt, notNullValue()) assertThat((notFoundAddressSt as Failure).error, instanceOf(MissingAttributeError::class.java)) diff --git a/forge/src/test/kotlin/com/github/kittinunf/forge/ParsingErrorTest.kt b/forge/src/test/kotlin/com/github/kittinunf/forge/ParsingErrorTest.kt index a6c73d6..607089e 100644 --- a/forge/src/test/kotlin/com/github/kittinunf/forge/ParsingErrorTest.kt +++ b/forge/src/test/kotlin/com/github/kittinunf/forge/ParsingErrorTest.kt @@ -22,9 +22,9 @@ class ParsingErrorTest : BaseTest() { companion object { val deserializer = { j: JSON -> ::User1.create - .map(j at "id") - .apply(j at "name") - .apply(j at "age") + .map(j at "id") + .apply(j at "name") + .apply(j at "age") } } } @@ -33,21 +33,22 @@ class ParsingErrorTest : BaseTest() { companion object { val deserializer = { j: JSON -> ::User2.create - .map(j at "name") - .apply(j at "age") - .apply(j list "levels") + .map(j at "name") + .apply(j at "age") + .apply(j list "levels") } } } @Test fun testMissingItem() { - val json = """ + val json = + """ { "name": "Clementina DuBuque", "age": 46, } - """.trimIndent() + """.trimIndent() val user = Forge.modelFromJson(json, User1.deserializer) @@ -57,13 +58,14 @@ class ParsingErrorTest : BaseTest() { @Test fun testInvalidTypeItem() { - val json = """ + val json = + """ { "id": 1, "name": "Clementina DuBuque", "age": 46 } - """.trimIndent() + """.trimIndent() val user = Forge.modelFromJson(json, User1.deserializer) @@ -73,12 +75,13 @@ class ParsingErrorTest : BaseTest() { @Test fun testMissingItems() { - val json = """ + val json = + """ { "name": "Clementina DuBuque", "age": 46 } - """.trimIndent() + """.trimIndent() val user = Forge.modelFromJson(json, User2.deserializer) @@ -88,13 +91,14 @@ class ParsingErrorTest : BaseTest() { @Test fun testInvalidTypeItems() { - val json = """ + val json = + """ { "name": "Clementina DuBuque", "age": 46, "levels" : ["1","2","3"] } - """.trimIndent() + """.trimIndent() val user = Forge.modelFromJson(json, User2.deserializer) @@ -104,7 +108,8 @@ class ParsingErrorTest : BaseTest() { @Test fun testSomeInvalidTypeItems() { - val json = """ + val json = + """ [ { "name": "Clementina DuBuque", @@ -117,7 +122,7 @@ class ParsingErrorTest : BaseTest() { "levels" : [3,2,1] } ] - """.trimIndent() + """.trimIndent() val result = Forge.modelsFromJson(json, User2.deserializer) val (users, error) = result diff --git a/gradle.properties b/gradle.properties index aa21e38..e99e366 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,17 +1,13 @@ # Project-wide Gradle settings. - # IDE (e.g. Android Studio) users: # Gradle settings configured through the IDE *will override* # any settings specified in this file. - # For more details on how to configure your build environment visit # http://www.gradle.org/docs/current/userguide/build_environment.html - # Specifies the JVM arguments used for the daemon process. # The setting is particularly useful for tweaking memory settings. # Default value: -Xmx10248m -XX:MaxPermSize=256m # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 - # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects @@ -19,11 +15,10 @@ artifactVersion=1.0.0-alpha2 artifactGroup=com.github.kittinunf.forge - bintrayVersion=1.8.4 jacocoVersion=0.8.3 jsonVersion=20190722 junitVersion=4.12 -kotlinVersion=1.3.60 -kotlinterVersion=2.3.0 -resultVersion=3.0.0 +kotlinVersion=1.4.0 +kotlinterVersion=3.0.2 +resultVersion=3.1.0