use of com.microsoft.appcenter.ingestion.models.one.UserExtension in project mobile-center-sdk-android by Microsoft.
the class PropertyConfiguratorTest method defaultTargetIsNotReturnedFromGetTransmissionTarget.
@Test
public void defaultTargetIsNotReturnedFromGetTransmissionTarget() {
/* Start the application with a token. */
Analytics analytics = Analytics.getInstance();
analytics.onStarting(mAppCenterHandler);
String defaultToken = "test";
analytics.onStarted(mock(Context.class), mChannel, null, defaultToken, true);
/* Create the test target with the same default token. */
AnalyticsTransmissionTarget target = Analytics.getTransmissionTarget(defaultToken);
/* Verify it's not the same instance. */
assertNotSame(target, analytics.mDefaultTransmissionTarget);
/* Set a Part A property on the target. */
target.getPropertyConfigurator().setAppName("someName");
/* Simulate what the pipeline does to convert from App Center to Common Schema. */
CommonSchemaLog log = new CommonSchemaEventLog();
log.setExt(new Extensions());
log.getExt().setApp(new AppExtension());
log.getExt().setUser(new UserExtension());
log.addTransmissionTarget("test");
log.setTag(target);
/* When the callback is called on the default target. */
analytics.mDefaultTransmissionTarget.getPropertyConfigurator().onPreparingLog(log, "groupName");
/* Then the log is not modified. */
assertNull(log.getExt().getApp().getName());
/* When the callback is called on the returned target. */
target.getPropertyConfigurator().onPreparingLog(log, "groupName");
/* Check the property is added to the log. */
assertEquals("someName", log.getExt().getApp().getName());
}
Aggregations