QueueManager { void setQueuePosition(long queueItemId) { int newPosition = getPositionFromQueueItem(queueItemId); if (newPosition != position) { position = newPosition; notifyQueue(); } } QueueManager(Random random); Flowable<Pair<Integer, Integer>> mode(); Flowable<Pair<List<Track>, Integer>> queue(); void setQueue(List<Track> queue, long queueItemId); Track currentTrack(); static final int SHUFFLE_OFF; static final int SHUFFLE_ALL; static final int REPEAT_OFF; static final int REPEAT_ALL; static final int REPEAT_ONE; }
@Test public void setQueuePosition() { queueManager.setQueuePosition(queue.get(3).queueItemId()); assertThat(queueManager.currentTrack(), is(queue.get(3))); TestSubscriber<Pair<List<Track>, Integer>> test = queueManager.queue().take(1).test(); test.awaitTerminalEvent(); int actualPosition = test.values().get(0).second; assertThat(actualPosition, is(3)); }