diff --git a/vector/src/test/java/im/vector/app/test/fakes/FakeRelationService.kt b/vector/src/test/java/im/vector/app/test/fakes/FakeRelationService.kt new file mode 100644 index 0000000000..828e3a25b6 --- /dev/null +++ b/vector/src/test/java/im/vector/app/test/fakes/FakeRelationService.kt @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2021 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.fakes + +import io.mockk.mockk +import org.matrix.android.sdk.api.session.room.model.message.PollType +import org.matrix.android.sdk.api.session.room.model.relation.RelationService +import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent +import org.matrix.android.sdk.api.util.Cancelable + +class FakeRelationService : RelationService by mockk() { + + private val cancelable = mockk() + + override fun editPoll(targetEvent: TimelineEvent, pollType: PollType, question: String, options: List): Cancelable = cancelable +} diff --git a/vector/src/test/java/im/vector/app/test/fakes/FakeRoom.kt b/vector/src/test/java/im/vector/app/test/fakes/FakeRoom.kt index ff87ab0fde..865b01551a 100644 --- a/vector/src/test/java/im/vector/app/test/fakes/FakeRoom.kt +++ b/vector/src/test/java/im/vector/app/test/fakes/FakeRoom.kt @@ -21,7 +21,16 @@ import org.matrix.android.sdk.api.session.room.Room class FakeRoom( private val fakeLocationSharingService: FakeLocationSharingService = FakeLocationSharingService(), + private val fakeSendService: FakeSendService = FakeSendService(), + private val fakeTimelineService: FakeTimelineService = FakeTimelineService(), + private val fakeRelationService: FakeRelationService = FakeRelationService(), ) : Room by mockk() { override fun locationSharingService() = fakeLocationSharingService + + override fun sendService() = fakeSendService + + override fun timelineService() = fakeTimelineService + + override fun relationService() = fakeRelationService } diff --git a/vector/src/test/java/im/vector/app/test/fakes/FakeSendService.kt b/vector/src/test/java/im/vector/app/test/fakes/FakeSendService.kt new file mode 100644 index 0000000000..04b9b95ce1 --- /dev/null +++ b/vector/src/test/java/im/vector/app/test/fakes/FakeSendService.kt @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2021 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.fakes + +import io.mockk.mockk +import org.matrix.android.sdk.api.session.room.model.message.PollType +import org.matrix.android.sdk.api.session.room.send.SendService +import org.matrix.android.sdk.api.util.Cancelable + +class FakeSendService : SendService by mockk() { + + private val cancelable = mockk() + + override fun sendPoll(pollType: PollType, question: String, options: List): Cancelable = cancelable +} diff --git a/vector/src/test/java/im/vector/app/test/fakes/FakeTimelineService.kt b/vector/src/test/java/im/vector/app/test/fakes/FakeTimelineService.kt new file mode 100644 index 0000000000..56f38724b1 --- /dev/null +++ b/vector/src/test/java/im/vector/app/test/fakes/FakeTimelineService.kt @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2021 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.fakes + +import io.mockk.every +import io.mockk.mockk +import org.matrix.android.sdk.api.session.room.timeline.TimelineEvent +import org.matrix.android.sdk.api.session.room.timeline.TimelineService + +class FakeTimelineService : TimelineService by mockk() { + + fun givenTimelineEvent(event: TimelineEvent) { + every { getTimelineEvent(any()) } returns event + } +}