Search in sources :

Example 6 with EventLog

use of com.microsoft.appcenter.analytics.ingestion.models.EventLog in project mobile-center-sdk-android by Microsoft.

the class AnalyticsTest method testAnalyticsListenerNull.

@Test
public void testAnalyticsListenerNull() {
    AnalyticsListener analyticsListener = mock(AnalyticsListener.class);
    Analytics.setListener(analyticsListener);
    Analytics.setListener(null);
    final EventLog testEventLog = new EventLog();
    testEventLog.setId(UUID.randomUUID());
    testEventLog.setName("name");
    final Exception testException = new Exception("test exception message");
    Channel.GroupListener listener = Analytics.getInstance().getChannelListener();
    listener.onBeforeSending(testEventLog);
    listener.onSuccess(testEventLog);
    listener.onFailure(testEventLog, testException);
    verify(analyticsListener, never()).onBeforeSending(any(EventLog.class));
    verify(analyticsListener, never()).onSendingSucceeded(any(EventLog.class));
    verify(analyticsListener, never()).onSendingFailed(any(EventLog.class), any(Exception.class));
}
Also used : AnalyticsListener(com.microsoft.appcenter.analytics.channel.AnalyticsListener) EventLog(com.microsoft.appcenter.analytics.ingestion.models.EventLog) Channel(com.microsoft.appcenter.channel.Channel) IOException(java.io.IOException) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

EventLog (com.microsoft.appcenter.analytics.ingestion.models.EventLog)6 PageLog (com.microsoft.appcenter.analytics.ingestion.models.PageLog)3 Log (com.microsoft.appcenter.ingestion.models.Log)3 Test (org.junit.Test)3 StartSessionLog (com.microsoft.appcenter.analytics.ingestion.models.StartSessionLog)2 Channel (com.microsoft.appcenter.channel.Channel)2 AppCenterLog (com.microsoft.appcenter.utils.AppCenterLog)2 HashMap (java.util.HashMap)2 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)2 Context (android.content.Context)1 NonNull (android.support.annotation.NonNull)1 AnalyticsListener (com.microsoft.appcenter.analytics.channel.AnalyticsListener)1 EventLogFactory (com.microsoft.appcenter.analytics.ingestion.models.json.EventLogFactory)1 PageLogFactory (com.microsoft.appcenter.analytics.ingestion.models.json.PageLogFactory)1 StartSessionLogFactory (com.microsoft.appcenter.analytics.ingestion.models.json.StartSessionLogFactory)1 AbstractChannelListener (com.microsoft.appcenter.channel.AbstractChannelListener)1 Device (com.microsoft.appcenter.ingestion.models.Device)1 LogContainer (com.microsoft.appcenter.ingestion.models.LogContainer)1 LogWithProperties (com.microsoft.appcenter.ingestion.models.LogWithProperties)1 DefaultLogSerializer (com.microsoft.appcenter.ingestion.models.json.DefaultLogSerializer)1