diff --git a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/room/timeline/PollAggregationTest.kt b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/room/timeline/PollAggregationTest.kt index ef8899e027..e104f29ed2 100644 --- a/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/room/timeline/PollAggregationTest.kt +++ b/matrix-sdk-android/src/androidTest/java/org/matrix/android/sdk/session/room/timeline/PollAggregationTest.kt @@ -19,6 +19,7 @@ package org.matrix.android.sdk.session.room.timeline import org.amshove.kluent.fail import org.amshove.kluent.shouldBe import org.amshove.kluent.shouldBeEqualTo +import org.amshove.kluent.shouldBeGreaterThan import org.amshove.kluent.shouldContain import org.amshove.kluent.shouldContainAll import org.junit.FixMethodOrder @@ -62,7 +63,7 @@ class PollAggregationTest : InstrumentedTest { val aliceTimeline = roomFromAlicePOV.createTimeline(null, TimelineSettings(30)) aliceTimeline.start() - val TOTAL_TEST_COUNT = 5 + val TOTAL_TEST_COUNT = 6 val lock = CountDownLatch(TOTAL_TEST_COUNT) val aliceEventsListener = object : Timeline.Listener { @@ -102,6 +103,11 @@ class PollAggregationTest : InstrumentedTest { TOTAL_TEST_COUNT - 4 -> { testAliceVotesOption1AndBobVotesOption2(pollContent, pollSummary) lock.countDown() + roomFromBobPOV.endPoll(pollEventId) + } + TOTAL_TEST_COUNT - 5 -> { + testEndedPoll(pollSummary) + lock.countDown() } else -> { fail("Lock count ${lock.count} didn't handled.") @@ -199,6 +205,10 @@ class PollAggregationTest : InstrumentedTest { } ?: run { fail("Aggregated poll content shouldn't be null after someone votes") } } + private fun testEndedPoll(pollSummary: PollResponseAggregatedSummary?) { + pollSummary?.closedTime ?: 0 shouldBeGreaterThan 0 + } + private fun assertTotalVotesCount(aggregatedContent: PollSummaryContent, expectedVoteCount: Int) { aggregatedContent.totalVotes shouldBeEqualTo expectedVoteCount aggregatedContent.votes?.size shouldBeEqualTo expectedVoteCount