diff --git a/vector/src/test/java/im/vector/app/SpaceStateHandlerImplTest.kt b/vector/src/test/java/im/vector/app/SpaceStateHandlerImplTest.kt index 8c94d5912b..f47f5ea9bf 100644 --- a/vector/src/test/java/im/vector/app/SpaceStateHandlerImplTest.kt +++ b/vector/src/test/java/im/vector/app/SpaceStateHandlerImplTest.kt @@ -21,21 +21,19 @@ import im.vector.app.test.fakes.FakeActiveSessionHolder import im.vector.app.test.fakes.FakeAnalyticsTracker import im.vector.app.test.fakes.FakeSession import im.vector.app.test.fakes.FakeUiStateRepository -import io.mockk.every +import im.vector.app.test.fixtures.RoomSummaryFixture.aRoomSummary import io.mockk.justRun -import io.mockk.mockk import kotlinx.coroutines.flow.first import kotlinx.coroutines.test.runTest import org.amshove.kluent.shouldBe import org.amshove.kluent.shouldBeEqualTo import org.junit.Before import org.junit.Test -import org.matrix.android.sdk.api.session.room.model.RoomSummary internal class SpaceStateHandlerImplTest { private val spaceId = "spaceId" - private val spaceSummary: RoomSummary = mockk() + private val spaceSummary = aRoomSummary(spaceId) private val session = FakeSession.withRoomSummary(spaceSummary) private val sessionDataSource = FakeActiveSessionDataSource() @@ -53,7 +51,6 @@ internal class SpaceStateHandlerImplTest { @Before fun setup() { justRun { uiStateRepository.storeSelectedSpace(any(), any()) } - every { spaceSummary.roomId } returns spaceId } @Test diff --git a/vector/src/test/java/im/vector/app/test/fixtures/RoomSummaryFixture.kt b/vector/src/test/java/im/vector/app/test/fixtures/RoomSummaryFixture.kt new file mode 100644 index 0000000000..ee37dac618 --- /dev/null +++ b/vector/src/test/java/im/vector/app/test/fixtures/RoomSummaryFixture.kt @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2022 New Vector Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package im.vector.app.test.fixtures + +import org.matrix.android.sdk.api.session.room.model.RoomSummary + +object RoomSummaryFixture { + + fun aRoomSummary(roomId: String) = RoomSummary( + roomId, + isEncrypted = false, + encryptionEventTs = 0, + typingUsers = emptyList(), + ) +}