TimelineStateHolder { public boolean startTimelineRequest() { return requestInFlight.compareAndSet(false, true); } TimelineStateHolder();   TimelineStateHolder(TimelineCursor nextCursor, TimelineCursor previousCursor); void resetCursors(); Long positionForNext(); Long positionForPrevious(); void setNextCursor(TimelineCursor timelineCursor); void setPreviousCursor(TimelineCursor timelineCursor); void setCursorsIfNull(TimelineCursor timelineCursor); boolean startTimelineRequest(); void finishTimelineRequest(); final AtomicBoolean requestInFlight; }
@Test public void testStartTimelineRequest() { final TimelineStateHolder holder = new TimelineStateHolder(); assertFalse(holder.requestInFlight.get()); assertTrue(holder.startTimelineRequest()); assertTrue(holder.requestInFlight.get()); assertFalse(holder.startTimelineRequest()); }