Fix flakiness in DefaultPlaybackSessionManagerTest
Two of the sessions are finished at the same time in the test and the order of the corresponding callbacks depends on the randomly generated session string and the order these strings are stored in a HashSet. Update test to assert both callbacks are called and they contain the right arguments, but don't assert on the order of these two callbacks. PiperOrigin-RevId: 424548819
This commit is contained in:
parent
73d9728f6a
commit
145e923dce
@ -788,18 +788,16 @@ public final class DefaultPlaybackSessionManagerTest {
|
|||||||
inOrder
|
inOrder
|
||||||
.verify(mockListener)
|
.verify(mockListener)
|
||||||
.onSessionCreated(eq(eventTimeFirstTimelineWindowOnly2), thirdId.capture());
|
.onSessionCreated(eq(eventTimeFirstTimelineWindowOnly2), thirdId.capture());
|
||||||
|
// The sessions may finish at the same time, so the order of these two callbacks is undefined.
|
||||||
|
ArgumentCaptor<String> finishedSessions = ArgumentCaptor.forClass(String.class);
|
||||||
inOrder
|
inOrder
|
||||||
.verify(mockListener)
|
.verify(mockListener, times(2))
|
||||||
.onSessionFinished(
|
.onSessionFinished(
|
||||||
eventTimeSecondTimeline,
|
eq(eventTimeSecondTimeline),
|
||||||
firstId.getValue(),
|
finishedSessions.capture(),
|
||||||
/* automaticTransitionToNextPlayback= */ false);
|
/* automaticTransitionToNextPlayback= */ eq(false));
|
||||||
inOrder
|
assertThat(finishedSessions.getAllValues())
|
||||||
.verify(mockListener)
|
.containsExactly(firstId.getValue(), thirdId.getValue());
|
||||||
.onSessionFinished(
|
|
||||||
eventTimeSecondTimeline,
|
|
||||||
thirdId.getValue(),
|
|
||||||
/* automaticTransitionToNextPlayback= */ false);
|
|
||||||
inOrder.verify(mockListener).onSessionActive(eventTimeSecondTimeline, secondId.getValue());
|
inOrder.verify(mockListener).onSessionActive(eventTimeSecondTimeline, secondId.getValue());
|
||||||
inOrder.verifyNoMoreInteractions();
|
inOrder.verifyNoMoreInteractions();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user