SessionTracker extends AbstractChannelListener { @Override public void onPreparingLog(@NonNull Log log, @NonNull String groupName) { if (log instanceof StartSessionLog || log instanceof StartServiceLog) { return; } Date timestamp = log.getTimestamp(); if (timestamp != null) { SessionContext.SessionInfo pastSession = SessionContext.getInstance().getSessionAt(timestamp.getTime()); if (pastSession != null) { log.setSid(pastSession.getSessionId()); } } else { log.setSid(mSid); mLastQueuedLogTime = SystemClock.elapsedRealtime(); } } SessionTracker(Channel channel, String groupName); @Override void onPreparingLog(@NonNull Log log, @NonNull String groupName); @WorkerThread void onActivityResumed(); @WorkerThread void onActivityPaused(); void clearSessions();  }
@Test public void ignoreStartService() { Log startServiceLog = spy(new StartServiceLog()); mSessionTracker.onPreparingLog(startServiceLog, TEST_GROUP); verify(mChannel, never()).enqueue(any(Log.class), anyString(), anyInt()); verify(startServiceLog, never()).setSid(any(UUID.class)); }