Skip to content
Snippets Groups Projects
Verified Commit 2aa96b3b authored by Torsten Grote's avatar Torsten Grote
Browse files

Fix proguard deserialization error

parent 4c7876a4
No related branches found
No related tags found
1 merge request!154Fix proguard deserialization error
ext {
kotlin_version = '1.8.0'
kotlin_version = '1.7.22' // 1.8.x has a jackson issue, test with JacksonProguardTest
hilt_version = '2.44.2'
nav_version = '2.5.3'
tor_version = '0.4.7.13'
......
......@@ -30,6 +30,7 @@ android {
vectorDrawables.useSupportLibrary = true
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
testInstrumentationRunnerArguments disableAnalytics: 'true'
}
buildTypes {
......
......@@ -21,6 +21,11 @@
-keep class io.netty.util.ReferenceCountUtil { *; }
-keep class io.netty.buffer.WrappedByteBuf { *; }
# Keep classes needed for instrumentation tests (here because testProguardFiles doesn't work)
-keep class kotlin.LazyKt
-keep class com.fasterxml.jackson.core.type.TypeReference
-keep class com.fasterxml.jackson.databind.ObjectMapper { *; }
# Don't warn about unused dependencies of H2 classes
-dontwarn org.h2.**
-dontnote org.h2.**
......
package org.briarproject.mailbox
import androidx.test.ext.junit.runners.AndroidJUnit4
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.module.kotlin.readValue
import com.fasterxml.jackson.module.kotlin.registerKotlinModule
import org.briarproject.mailbox.core.contacts.Contact
import org.junit.Assert.assertEquals
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(AndroidJUnit4::class)
class JacksonProguardTest {
private val mapper = ObjectMapper().apply { registerKotlinModule() }
/**
* Tests if we can deserialize our objects with Jackson while using proguard:
* [issue](https://github.com/FasterXML/jackson-module-kotlin/issues/522)
*/
@Test
fun testDeserializeContact() {
val json = """
{
"contactId": 1,
"token": "foo",
"inboxId": "bar",
"outboxId": "42"
}
""".trimIndent()
val contact: Contact = mapper.readValue(json)
assertEquals(1, contact.contactId)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment