@Test
  public void testReadConfig_JDBC() throws Exception {
    // 建立私有方法的mock对象
    ConfigParamManager mock =
        PowerMock.createPartialMock(ConfigParamManager.class, "getConfigType");
    // 录制私有方法行为
    PowerMock.expectPrivate(mock, "getConfigType", EasyMock.anyObject(Document.class))
        .andReturn("JDBC");
    // 回放mock对象行为
    PowerMock.replay(mock);

    EnvConfigBean envConfig = mock.readConfig(configLocation);

    assertNotNull(envConfig);
    assertEquals("JDBC", envConfig.getConfigType());
    assertTrue(envConfig.getJdbc().keySet().size() > 0);
    for (ConfigDataSourceBean csb : envConfig.getJdbc().values()) {
      System.out.println("jdbc config==>" + csb.getName() + " = " + csb.getValue());
    }
    for (ConfigParamBean cpb : ConfigParamMap.getConfigParamMap().values()) {
      System.out.println(
          "jdbc configParam==>"
              + cpb.getName()
              + " || "
              + cpb.getValue()
              + " || "
              + cpb.getSystem());
    }
  }
  /** @throws Exception */
  @Test(expected = EnvironmentConfigException.class)
  public void testReadConfig_JNDI_EnvironmentConfigException() throws Exception {
    // 建立私有方法的mock对象
    ConfigParamManager mock =
        PowerMock.createPartialMock(ConfigParamManager.class, "getConfigType");
    // 录制私有方法行为
    PowerMock.expectPrivate(mock, "getConfigType", EasyMock.anyObject(Document.class))
        .andReturn("JNDI");

    // 建立mock对象
    Document mockDocument = EasyMock.createMock(Document.class);
    // Document a = PowerMock.createMock(Document.class);
    // 录制public方法行为
    EasyMock.expect(mockDocument.getElementsByTagName(EasyMock.anyObject(String.class)))
        .andReturn(null);

    // 回放mock对象行为
    PowerMock.replay(mock);
    // 回放mock对象行为
    EasyMock.replay(mockDocument);

    EnvConfigBean envConfig = mock.readConfig(configLocation);

    PowerMock.verifyAll();
    EasyMock.verify(mockDocument);
  }
  @Test
  public void testCustomerConfigLocation() throws Exception {
    // 建立私有方法的mock对象
    ConfigParamManager mock =
        PowerMock.createPartialMock(ConfigParamManager.class, "getConfigType");
    // 录制私有方法行为
    PowerMock.expectPrivate(mock, "getConfigType", EasyMock.anyObject(Document.class))
        .andReturn("XML");
    // 回放mock对象行为
    PowerMock.replay(mock);
    EnvConfigBean envConfig = mock.readConfig("test/testEnvironmentConfig.xml");

    assertEquals(3, envConfig.getConfigParam().entrySet().size());
    PowerMock.verifyAll();
  }
  @Test
  public void readConfig_A$_XML() throws Exception {
    // 建立私有方法的mock对象
    ConfigParamManager mock =
        PowerMock.createPartialMock(ConfigParamManager.class, "getConfigType");
    // 录制私有方法行为
    PowerMock.expectPrivate(mock, "getConfigType", EasyMock.anyObject(Document.class))
        .andReturn("XML");
    // 回放mock对象行为
    PowerMock.replay(mock);

    EnvConfigBean envConfig = mock.readConfig();
    assertNotNull(envConfig);
    assertEquals("XML", envConfig.getConfigType());
    assertEquals(
        "http://172.16.30.20:8090/xms/",
        ConfigParamMap.getConfigParamMap().get("xms_url").getValue());

    PowerMock.verifyAll();
  }
 @Test
 public void testSetEnvConfigLocation() {
   ConfigParamManager cpm = new ConfigParamManager();
   cpm.setEnvConfigLocation("abc");
   assertEquals("environmentConfig.xml", cpm.getEnvConfigLocation());
 }