JsonUtils { public <T> String serialize(final T object) { try { return OBJECT_MAPPER.writeValueAsString(object); } catch (Exception e) { LOGGER.error(UNEXPECTED_EXCEPTION, e); return null; } }  T deserializeFromFile(final String fileName, final Class<T> type); String serialize(final T object); T deserialize(final String jsonString, final Class<T> type); C deserialize(final String jsonString, final Class<C> collectionType,
            final Class<T> elementType); JsonNode readJsonNodeFromFile(final String jsonFileName); JsonNode readJsonNodeFromObject(final T object);  }
@Test public void testSerialize() { Student student = createStudent(); String serializedStudent = this.jsonUtils.serialize(student); Assert.assertNotNull(serializedStudent); }
@Test public void testDoNotSerializaNullProperties() { PolicySet ps = new PolicySet(); String serializedObject = this.jsonUtils.serialize(ps); Assert.assertNotNull(serializedObject); Assert.assertFalse(serializedObject.contains("null")); }