public static Object serialize(Object bean) throws NullPointerException {
        return serialize(bean, false);
    }
@Test
    public void serialize() {
        TestJsonBean bean = new TestJsonBean();
        boolean error = false;
        try {
            Map map = (Map) BeanSerializer.serialize(bean);
        } catch (Exception e) {
            error = true;
        }
        Assert.assertTrue(error);

        error = false;
        bean.setName("zzzggg");
        try {
            Map map = (Map) BeanSerializer.serialize(bean, true);
            Assert.assertEquals(map.get("Name"), "zzzggg");
            Assert.assertEquals(map.get("Sex"), false);
            Assert.assertEquals(map.get("age"), 0);
            Assert.assertFalse(map.containsKey("friends"));
            Assert.assertTrue(map.containsKey("Remark"));
            Assert.assertTrue(map.containsKey(JSON.CLASS_KEY));

            map = (Map) BeanSerializer.serialize(bean);
            Assert.assertEquals(map.get("Name"), "zzzggg");
            Assert.assertEquals(map.get("Sex"), false);
            Assert.assertEquals(map.get("age"), 0);
            Assert.assertFalse(map.containsKey("friends"));
            Assert.assertTrue(map.containsKey("Remark"));
            Assert.assertFalse(map.containsKey(JSON.CLASS_KEY));
        } catch (Exception e) {
            error = true;
        }
        Assert.assertFalse(error);

        bean.setName("zzzgg");
        bean.setSex(true);
        bean.setAge(111);
        bean.setStep(1234567890l);
        bean.setFriends(new ArrayList<TestJsonBean>());
        bean.setStatus(TestJsonBean.Status.START);
        error = false;
        try {
            Map map = (Map) BeanSerializer.serialize(bean, true);
            Assert.assertEquals(map.get("Name"), "zzzgg");
            Assert.assertEquals(map.get("Sex"), true);
            Assert.assertEquals(map.get("age"), 111);
            Assert.assertTrue(map.containsKey("friends"));
            Assert.assertTrue(map.containsKey("Remark"));
            Assert.assertTrue(map.containsKey(JSON.CLASS_KEY));

            map = (Map) BeanSerializer.serialize(bean);
            Assert.assertEquals(map.get("Name"), "zzzgg");
            Assert.assertEquals(map.get("Sex"), true);
            Assert.assertEquals(map.get("age"), 111);
            Assert.assertTrue(map.containsKey("friends"));
            Assert.assertTrue(map.containsKey("Remark"));
            Assert.assertFalse(map.containsKey(JSON.CLASS_KEY));
        } catch (Exception e) {
            error = true;
        }
        Assert.assertFalse(error);
    }