@Test
public void testGetProperty() throws Exception {

    TestBean config = new TestBean();
    config.setAlias("1111aaaa");
    config.setHeartbeat(2000);
    config.setRegister(false);
    Assert.assertEquals(BeanUtils.getProperty(config, "alias", String.class), "1111aaaa");
    Assert.assertTrue(BeanUtils.getProperty(config, "heartbeat", int.class) == 2000);
    Assert.assertTrue((Integer) BeanUtils.getProperty(config, "heartbeat", null) == 2000);
    Assert.assertFalse(BeanUtils.getProperty(config, "register", boolean.class));
    boolean error = false;
    try {
        BeanUtils.getProperty(config, "xxx", String.class);
    } catch (Exception e) {
        error = true;
    }
    Assert.assertTrue(error);
}