From ff8a20801253969911f7fde8faba3265cca58cb2 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 18 Dec 2020 16:04:46 +0100 Subject: [PATCH] Change to immutable list --- .../org/matrix/android/sdk/common/CryptoTestData.kt | 2 +- .../matrix/android/sdk/common/CryptoTestHelper.kt | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CryptoTestData.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CryptoTestData.kt index 693ab28da1..b6bedbd719 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CryptoTestData.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CryptoTestData.kt @@ -19,7 +19,7 @@ package org.matrix.android.sdk.common import org.matrix.android.sdk.api.session.Session data class CryptoTestData(val roomId: String, - val sessions: MutableList = mutableListOf()) { + val sessions: List) { val firstSession: Session get() = sessions.first() diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CryptoTestHelper.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CryptoTestHelper.kt index 5d3407dde1..f219986c49 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CryptoTestHelper.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/common/CryptoTestHelper.kt @@ -73,7 +73,7 @@ class CryptoTestHelper(private val mTestHelper: CommonTestHelper) { } } - return CryptoTestData(roomId, mutableListOf(aliceSession)) + return CryptoTestData(roomId, listOf(aliceSession)) } /** @@ -139,7 +139,7 @@ class CryptoTestHelper(private val mTestHelper: CommonTestHelper) { // assertNotNull(roomFromBobPOV.powerLevels) // assertTrue(roomFromBobPOV.powerLevels.maySendMessage(bobSession.myUserId)) - return CryptoTestData(aliceRoomId, mutableListOf(aliceSession, bobSession)) + return CryptoTestData(aliceRoomId, listOf(aliceSession, bobSession)) } /** @@ -157,7 +157,7 @@ class CryptoTestHelper(private val mTestHelper: CommonTestHelper) { // wait the initial sync SystemClock.sleep(1000) - return CryptoTestData(aliceRoomId, mutableListOf(aliceSession, cryptoTestData.secondSession!!, samSession)) + return CryptoTestData(aliceRoomId, listOf(aliceSession, cryptoTestData.secondSession!!, samSession)) } /** @@ -395,7 +395,7 @@ class CryptoTestHelper(private val mTestHelper: CommonTestHelper) { room.enableEncryption() } - val cryptoTestData = CryptoTestData(roomId, mutableListOf(aliceSession)) + val sessions = mutableListOf(aliceSession) for (index in 1 until numberOfMembers) { mTestHelper .createAccount("User_$index", defaultSessionParams) @@ -403,9 +403,9 @@ class CryptoTestHelper(private val mTestHelper: CommonTestHelper) { .also { println("TEST -> " + it.myUserId + " invited") } .also { session -> mTestHelper.doSync { session.joinRoom(room.roomId, null, emptyList(), it) } } .also { println("TEST -> " + it.myUserId + " joined") } - .also { session -> cryptoTestData.sessions.add(session) } + .also { session -> sessions.add(session) } } - return cryptoTestData + return CryptoTestData(roomId, sessions) } }