Improve asXId and make tests pass in release and debug mode.

This commit is contained in:
Benoit Marty 2023-04-12 09:14:55 +02:00 committed by Benoit Marty
parent b081ecfb6a
commit eb6276e09d
15 changed files with 121 additions and 25 deletions

View file

@ -20,7 +20,7 @@ import com.google.common.truth.Truth.assertThat
import io.element.android.libraries.matrix.test.AN_EVENT_ID
import io.element.android.libraries.matrix.test.A_ROOM_ID
import io.element.android.libraries.push.providers.api.PushData
import org.junit.Assert.assertThrows
import io.element.android.tests.testutils.assertNullOrThrow
import org.junit.Test
class UnifiedPushParserTest {
@ -52,7 +52,7 @@ class UnifiedPushParserTest {
@Test
fun `test empty roomId`() {
val pushParser = UnifiedPushParser()
assertThrows(IllegalStateException::class.java) {
assertNullOrThrow {
pushParser.parse(UNIFIED_PUSH_DATA.replace(A_ROOM_ID.value, "").toByteArray(), aClientSecret)
}
}
@ -60,7 +60,7 @@ class UnifiedPushParserTest {
@Test
fun `test invalid roomId`() {
val pushParser = UnifiedPushParser()
assertThrows(IllegalStateException::class.java) {
assertNullOrThrow {
pushParser.parse(UNIFIED_PUSH_DATA.mutate(A_ROOM_ID.value, "aRoomId:domain"), aClientSecret)
}
}
@ -68,7 +68,7 @@ class UnifiedPushParserTest {
@Test
fun `test empty eventId`() {
val pushParser = UnifiedPushParser()
assertThrows(IllegalStateException::class.java) {
assertNullOrThrow {
pushParser.parse(UNIFIED_PUSH_DATA.mutate(AN_EVENT_ID.value, ""), aClientSecret)
}
}
@ -76,7 +76,7 @@ class UnifiedPushParserTest {
@Test
fun `test invalid eventId`() {
val pushParser = UnifiedPushParser()
assertThrows(IllegalStateException::class.java) {
assertNullOrThrow {
pushParser.parse(UNIFIED_PUSH_DATA.mutate(AN_EVENT_ID.value, "anEventId"), aClientSecret)
}
}