public static Object serialize(Object bean) throws NullPointerException {
        return serialize(bean, false);
    }
@Test
    public void serializeMap() {
        boolean error = false;
        Map<Object, Object> bean = createTestMap();
        try {
            Map map = (Map) BeanSerializer.serialize(bean, true);
            for (Map.Entry<Object, Object> entry : bean.entrySet()) {
                if (!map.containsKey(entry.getKey())) {
                    error = true;
                    break;
                }
            }
            Assert.assertFalse(error);

            map = (Map) BeanSerializer.serialize(bean);
            for (Map.Entry<Object, Object> entry : bean.entrySet()) {
                if (!map.containsKey(entry.getKey())) {
                    error = true;
                    break;
                }
            }
            Assert.assertFalse(error);
        } catch (Exception e) {
            error = true;
        }
        Assert.assertFalse(error);
    }