Restore private visibility of fake component fields

This commit is contained in:
Florian Renaud 2023-01-09 18:13:05 +01:00
parent 39c0cb2015
commit 2df94807e0
3 changed files with 6 additions and 7 deletions

View file

@ -25,6 +25,7 @@ import org.amshove.kluent.shouldBeEqualTo
import org.amshove.kluent.shouldBeNull
import org.amshove.kluent.shouldNotBeNull
import org.junit.Test
import org.matrix.android.sdk.api.session.getRoom
import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent
private const val A_ROOM_ID = "A_ROOM_ID"
@ -35,13 +36,11 @@ internal class GetVoiceBroadcastStateEventUseCaseTest {
private val fakeSession = FakeSession()
private val getVoiceBroadcastStateEventUseCase = GetVoiceBroadcastStateEventUseCase(fakeSession)
private val fakeRoom get() = fakeSession.fakeRoomService.fakeRoom
@Test
fun `given there is no event related to the given vb, when execute, then return null`() {
// Given
val aVoiceBroadcast = VoiceBroadcast(A_VOICE_BROADCAST_ID, A_ROOM_ID)
every { fakeRoom.fakeTimelineService.getTimelineEventsRelatedTo(any(), any()) } returns emptyList()
every { fakeSession.getRoom(A_ROOM_ID)?.timelineService()?.getTimelineEventsRelatedTo(any(), any()) } returns emptyList()
// When
val result = getVoiceBroadcastStateEventUseCase.execute(aVoiceBroadcast)
@ -74,7 +73,7 @@ internal class GetVoiceBroadcastStateEventUseCaseTest {
every { root.originServerTs } returns 2L
},
)
every { fakeRoom.fakeTimelineService.getTimelineEventsRelatedTo(any(), any()) } returns aListOfTimelineEvents
every { fakeSession.getRoom(A_ROOM_ID)?.timelineService()?.getTimelineEventsRelatedTo(any(), any()) } returns aListOfTimelineEvents
// When
val result = getVoiceBroadcastStateEventUseCase.execute(aVoiceBroadcast)
@ -102,7 +101,7 @@ internal class GetVoiceBroadcastStateEventUseCaseTest {
every { root.originServerTs } returns 2L
},
)
every { fakeRoom.fakeTimelineService.getTimelineEventsRelatedTo(any(), any()) } returns aListOfTimelineEvents
every { fakeSession.getRoom(A_ROOM_ID)?.timelineService()?.getTimelineEventsRelatedTo(any(), any()) } returns aListOfTimelineEvents
// When
val result = getVoiceBroadcastStateEventUseCase.execute(aVoiceBroadcast)

View file

@ -22,7 +22,7 @@ import org.matrix.android.sdk.api.session.room.Room
class FakeRoom(
private val fakeLocationSharingService: FakeLocationSharingService = FakeLocationSharingService(),
private val fakeSendService: FakeSendService = FakeSendService(),
val fakeTimelineService: FakeTimelineService = FakeTimelineService(),
private val fakeTimelineService: FakeTimelineService = FakeTimelineService(),
private val fakeRelationService: FakeRelationService = FakeRelationService(),
private val fakeStateService: FakeStateService = FakeStateService(),
) : Room by mockk() {

View file

@ -22,7 +22,7 @@ import org.matrix.android.sdk.api.session.room.RoomService
import org.matrix.android.sdk.api.session.room.model.RoomSummary
class FakeRoomService(
val fakeRoom: FakeRoom = FakeRoom()
private val fakeRoom: FakeRoom = FakeRoom()
) : RoomService by mockk() {
override fun getRoom(roomId: String) = fakeRoom