From 318a5a8fc10f076257b173a37f67a51954bfe562 Mon Sep 17 00:00:00 2001 From: valere Date: Mon, 6 Feb 2023 11:44:14 +0100 Subject: [PATCH] Fix test compilation --- .../matrix/android/sdk/common/CommonTestHelper.kt | 1 - .../sdk/internal/crypto/E2eeSanityTests.kt | 15 ++------------- .../crypto/E2eeTestVerificationTestDirty.kt | 2 +- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CommonTestHelper.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CommonTestHelper.kt index 8f29e05609..396a7fc129 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CommonTestHelper.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CommonTestHelper.kt @@ -541,7 +541,6 @@ class CommonTestHelper internal constructor(context: Context, val cryptoConfig: return } } - Timber.w("## VALR Trial success for") } suspend fun waitForCallback(timeout: Long = TestConstants.timeOutMillis, block: (MatrixCallback) -> Unit): T { diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/E2eeSanityTests.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/E2eeSanityTests.kt index c43f98fe67..8839bf6d23 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/E2eeSanityTests.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/E2eeSanityTests.kt @@ -41,7 +41,6 @@ import org.matrix.android.sdk.api.session.events.model.content.EncryptedEventCon import org.matrix.android.sdk.api.session.events.model.toModel import org.matrix.android.sdk.api.session.getRoom import org.matrix.android.sdk.api.session.room.getTimelineEvent -import org.matrix.android.sdk.api.session.room.model.Membership import org.matrix.android.sdk.api.session.room.model.message.MessageContent import org.matrix.android.sdk.common.CommonTestHelper import org.matrix.android.sdk.common.CommonTestHelper.Companion.runCryptoTest @@ -119,7 +118,7 @@ class E2eeSanityTests : InstrumentedTest { fail("New Users shouldn't be able to decrypt history") } ) { - val timelineEvent = otherSession.getRoom(e2eRoomID)?.getTimelineEvent(sentEventId!!).also { + val timelineEvent = otherSession.getRoom(e2eRoomID)?.getTimelineEvent(sentEventId).also { Log.v("#E2E TEST", "Event seen by new user ${it?.root?.getClearType()}|${it?.root?.mCryptoError}") } timelineEvent != null && @@ -142,7 +141,7 @@ class E2eeSanityTests : InstrumentedTest { fail("New user ${otherSession.myUserId.take(10)} should be able to decrypt the second message") } ) { - val timelineEvent = otherSession.getRoom(e2eRoomID)?.getTimelineEvent(secondSentEventId!!).also { + val timelineEvent = otherSession.getRoom(e2eRoomID)?.getTimelineEvent(secondSentEventId).also { Log.v("#E2E TEST", "Second Event seen by new user ${it?.root?.getClearType()}|${it?.root?.mCryptoError}") } timelineEvent != null && @@ -721,16 +720,6 @@ class E2eeSanityTests : InstrumentedTest { // } // } - private suspend fun ensureMembersHaveJoined(testHelper: CommonTestHelper, aliceSession: Session, otherAccounts: List, e2eRoomID: String) { - testHelper.retryPeriodically { - otherAccounts.map { - aliceSession.roomService().getRoomMember(it.myUserId, e2eRoomID)?.membership - }.all { - it == Membership.JOIN - } - } - } - private suspend fun ensureIsDecrypted(testHelper: CommonTestHelper, sentEventIds: List, session: Session, e2eRoomID: String) { sentEventIds.forEach { sentEventId -> testHelper.retryPeriodically { diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/E2eeTestVerificationTestDirty.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/E2eeTestVerificationTestDirty.kt index 2f7ad5861c..a1142daae2 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/E2eeTestVerificationTestDirty.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/internal/crypto/E2eeTestVerificationTestDirty.kt @@ -18,7 +18,7 @@ package org.matrix.android.sdk.internal.crypto import android.util.Log import androidx.test.filters.LargeTest -import junit.framework.Assert.fail +import junit.framework.TestCase.fail import kotlinx.coroutines.delay import org.junit.FixMethodOrder import org.junit.Test