Change to immutable list

This commit is contained in:
Benoit Marty 2020-12-18 16:04:46 +01:00
parent 7732bd47ce
commit ff8a208012
2 changed files with 7 additions and 7 deletions

View File

@ -19,7 +19,7 @@ package org.matrix.android.sdk.common
import org.matrix.android.sdk.api.session.Session import org.matrix.android.sdk.api.session.Session
data class CryptoTestData(val roomId: String, data class CryptoTestData(val roomId: String,
val sessions: MutableList<Session> = mutableListOf()) { val sessions: List<Session>) {
val firstSession: Session val firstSession: Session
get() = sessions.first() get() = sessions.first()

View File

@ -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) // assertNotNull(roomFromBobPOV.powerLevels)
// assertTrue(roomFromBobPOV.powerLevels.maySendMessage(bobSession.myUserId)) // 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 // wait the initial sync
SystemClock.sleep(1000) 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() room.enableEncryption()
} }
val cryptoTestData = CryptoTestData(roomId, mutableListOf(aliceSession)) val sessions = mutableListOf(aliceSession)
for (index in 1 until numberOfMembers) { for (index in 1 until numberOfMembers) {
mTestHelper mTestHelper
.createAccount("User_$index", defaultSessionParams) .createAccount("User_$index", defaultSessionParams)
@ -403,9 +403,9 @@ class CryptoTestHelper(private val mTestHelper: CommonTestHelper) {
.also { println("TEST -> " + it.myUserId + " invited") } .also { println("TEST -> " + it.myUserId + " invited") }
.also { session -> mTestHelper.doSync<Unit> { session.joinRoom(room.roomId, null, emptyList(), it) } } .also { session -> mTestHelper.doSync<Unit> { session.joinRoom(room.roomId, null, emptyList(), it) } }
.also { println("TEST -> " + it.myUserId + " joined") } .also { println("TEST -> " + it.myUserId + " joined") }
.also { session -> cryptoTestData.sessions.add(session) } .also { session -> sessions.add(session) }
} }
return cryptoTestData return CryptoTestData(roomId, sessions)
} }
} }