@Test public void record_shouldSampleEvent() throws Exception { subject.record(mockEvent); verify(mockEventSampler).sample(mockEvent); }
@Override public void record(@NonNull BaseEvent baseEvent) { if (!mEventSampler.sample(baseEvent)) { return; } if (mEventQueue.size() >= QUEUE_MAX_SIZE) { MoPubLog.d("EventQueue is at max capacity. " + "Event \"" + baseEvent.getName() + "\" is being dropped."); return; } mEventQueue.add(baseEvent); if (mEventQueue.size() >= EVENT_COUNT_SEND_THRESHHOLD) { sendEvents(); } scheduleNextPoll(); }
ScribeEventRecorder implements EventRecorder { @Override public void record(@NonNull BaseEvent baseEvent) { if (!mEventSampler.sample(baseEvent)) { return; } if (mEventQueue.size() >= QUEUE_MAX_SIZE) { MoPubLog.d("EventQueue is at max capacity. " + "Event \"" + baseEvent.getName() + "\" is being dropped."); return; } mEventQueue.add(baseEvent); if (mEventQueue.size() >= EVENT_COUNT_SEND_THRESHHOLD) { sendEvents(); } scheduleNextPoll(); } }
ScribeEventRecorder implements EventRecorder { @Override public void record(@NonNull BaseEvent baseEvent) { if (!mEventSampler.sample(baseEvent)) { return; } if (mEventQueue.size() >= QUEUE_MAX_SIZE) { MoPubLog.d("EventQueue is at max capacity. " + "Event \"" + baseEvent.getName() + "\" is being dropped."); return; } mEventQueue.add(baseEvent); if (mEventQueue.size() >= EVENT_COUNT_SEND_THRESHHOLD) { sendEvents(); } scheduleNextPoll(); } ScribeEventRecorder(@NonNull Looper looper); @VisibleForTesting  ScribeEventRecorder(@NonNull EventSampler eventSampler,
            @NonNull Queue<BaseEvent> eventQueue,
            @NonNull EventSerializer eventSerializer,
            @NonNull ScribeRequestManager scribeRequestManager,
            @NonNull Handler handler); }
ScribeEventRecorder implements EventRecorder { @Override public void record(@NonNull BaseEvent baseEvent) { if (!mEventSampler.sample(baseEvent)) { return; } if (mEventQueue.size() >= QUEUE_MAX_SIZE) { MoPubLog.d("EventQueue is at max capacity. " + "Event \"" + baseEvent.getName() + "\" is being dropped."); return; } mEventQueue.add(baseEvent); if (mEventQueue.size() >= EVENT_COUNT_SEND_THRESHHOLD) { sendEvents(); } scheduleNextPoll(); } ScribeEventRecorder(@NonNull Looper looper); @VisibleForTesting  ScribeEventRecorder(@NonNull EventSampler eventSampler,
            @NonNull Queue<BaseEvent> eventQueue,
            @NonNull EventSerializer eventSerializer,
            @NonNull ScribeRequestManager scribeRequestManager,
            @NonNull Handler handler); @Override void record(@NonNull BaseEvent baseEvent); }
ScribeEventRecorder implements EventRecorder { @Override public void record(@NonNull BaseEvent baseEvent) { if (!mEventSampler.sample(baseEvent)) { return; } if (mEventQueue.size() >= QUEUE_MAX_SIZE) { MoPubLog.d("EventQueue is at max capacity. " + "Event \"" + baseEvent.getName() + "\" is being dropped."); return; } mEventQueue.add(baseEvent); if (mEventQueue.size() >= EVENT_COUNT_SEND_THRESHHOLD) { sendEvents(); } scheduleNextPoll(); } ScribeEventRecorder(@NonNull Looper looper); @VisibleForTesting  ScribeEventRecorder(@NonNull EventSampler eventSampler,
            @NonNull Queue<BaseEvent> eventQueue,
            @NonNull EventSerializer eventSerializer,
            @NonNull ScribeRequestManager scribeRequestManager,
            @NonNull Handler handler); @Override void record(@NonNull BaseEvent baseEvent);  }