@Test
  public void testErrorOnLoadingExternalPropertiesDoesNotPropagate() throws Exception {
    PropertiesLoader propertiesLoader =
        new PropertiesLoader() {

          @Override
          public Map<String, String> loadProperties() {
            throw new RuntimeException("Expected - thrown by test");
          }
        };
    JmxTransConfigurationXmlLoader configLoader =
        new JmxTransConfigurationXmlLoader(
            "classpath:jmxtrans-external-properties-test.xml", propertiesLoader);
    JmxTransExporterConfiguration config = configLoader.build(configLoader);
    assertThat(config.getCollectInterval(), equalTo(222));
  }
  @Test
  public void testExternalPropertiesSourceIsUsed() throws Exception {
    PropertiesLoader propertiesLoader =
        new PropertiesLoader() {

          @Override
          public Map<String, String> loadProperties() {
            HashMap<String, String> m = new HashMap<>();
            m.put("jmxtrans.agent.collect.interval", "999");
            return m;
          }
        };
    JmxTransConfigurationXmlLoader configLoader =
        new JmxTransConfigurationXmlLoader(
            "classpath:jmxtrans-external-properties-test.xml", propertiesLoader);
    JmxTransExporterConfiguration config = configLoader.build(configLoader);
    assertThat(config.getCollectInterval(), equalTo(999));
  }