### Question:
TimelineStateHolder { public boolean processStateEvent(@NonNull final Event event, @NonNull final EventTimeline.Direction direction, final boolean considerNewContent) { final RoomState affectedState; final IMXStore store; if (direction == EventTimeline.Direction.FORWARDS) { affectedState = mState; store = mStore; } else { affectedState = mBackState; store = null; } final boolean isProcessed = affectedState.applyState(event, considerNewContent, store); if (isProcessed && direction == EventTimeline.Direction.FORWARDS) { mStore.storeLiveStateForRoom(mRoomId); } return isProcessed; } TimelineStateHolder(@NonNull final MXDataHandler dataHandler,
                        @NonNull final IMXStore store,
                        @NonNull final String roomId); void clear(); @NonNull RoomState getState(); void setState(@NonNull final RoomState state); @NonNull RoomState getBackState(); void setBackState(@NonNull final RoomState state); void deepCopyState(final EventTimeline.Direction direction); boolean processStateEvent(@NonNull final Event event,
                                     @NonNull final EventTimeline.Direction direction,
                                     final boolean considerNewContent); void setRoomId(@NonNull final String roomId);  }### Answer:
@Test public void processStateEvent_WithConformingEvent__ShouldBeProcessed() { final Event event = new Event(); event.roomId = ROOM_ID; event.type = Event.EVENT_TYPE_STATE_ROOM_NAME; event.stateKey = Event.EVENT_TYPE_STATE_ROOM_NAME; Assert.assertTrue(mTimelineStateHolder.processStateEvent(event, EventTimeline.Direction.FORWARDS, true)); }
@Test public void processStateEvent_WhenDirectionIsForward__ShouldStoreLiveState() { final Event event = new Event(); event.roomId = ROOM_ID; event.stateKey = Event.EVENT_TYPE_STATE_ROOM_NAME; event.type = Event.EVENT_TYPE_STATE_ROOM_NAME; mTimelineStateHolder.processStateEvent(event, EventTimeline.Direction.FORWARDS, true); Mockito.verify(mIMXStore, Mockito.times(1)).storeLiveStateForRoom(Mockito.anyString()); }
@Test public void processStateEvent_WhenNoStateKeyIsGiven__ShouldNotBeProcessed() { final Event event = new Event(); event.roomId = ROOM_ID; event.type = Event.EVENT_TYPE_STATE_ROOM_NAME; Assert.assertFalse(mTimelineStateHolder.processStateEvent(event, EventTimeline.Direction.FORWARDS, true)); }