@Test
  public void testContextInitializers() {
    AppInsightsConfigurationBuilder mockParser = createMockParser(true, true, false);
    ApplicationInsightsXmlConfiguration appConf = mockParser.build(null);
    appConf.setInstrumentationKey(MOCK_IKEY);

    ContextInitializersXmlElement contextInitializersXmlElement =
        new ContextInitializersXmlElement();
    ArrayList<AddTypeXmlElement> contexts = new ArrayList<AddTypeXmlElement>();
    AddTypeXmlElement addXmlElement = new AddTypeXmlElement();
    addXmlElement.setType(
        "com.microsoft.applicationinsights.extensibility.initializer.DeviceInfoContextInitializer");
    contexts.add(addXmlElement);
    contextInitializersXmlElement.setAdds(contexts);
    appConf.setContextInitializers(contextInitializersXmlElement);

    TelemetryConfiguration mockConfiguration = new TelemetryConfiguration();

    initializeWithFactory(mockParser, mockConfiguration);

    assertEquals(mockConfiguration.isTrackingDisabled(), false);
    assertEquals(mockConfiguration.getInstrumentationKey(), MOCK_IKEY);
    assertEquals(mockConfiguration.getContextInitializers().size(), 3);
    assertTrue(mockConfiguration.getTelemetryInitializers().isEmpty());
    assertTrue(mockConfiguration.getChannel() instanceof StdOutChannel);
  }
  @Test
  public void testInitializeAllDefaults() throws Exception {
    AppInsightsConfigurationBuilder mockParser = createMockParser(true, true, false);
    ApplicationInsightsXmlConfiguration appConf = mockParser.build(null);
    appConf.setInstrumentationKey(MOCK_IKEY);

    TelemetryConfiguration mockConfiguration = new TelemetryConfiguration();

    initializeWithFactory(mockParser, mockConfiguration);

    assertEquals(mockConfiguration.isTrackingDisabled(), false);
    assertEquals(mockConfiguration.getInstrumentationKey(), MOCK_IKEY);
    assertEquals(mockConfiguration.getContextInitializers().size(), 2);
    assertTrue(mockConfiguration.getTelemetryInitializers().isEmpty());
    assertTrue(mockConfiguration.getChannel() instanceof StdOutChannel);
  }