public int add(Object o) {
        HollowTypeMapper typeMapper = getTypeMapper(o.getClass(), null, null);
        return typeMapper.write(o);
    }
@Test
    public void testNullElements() {
        HollowObjectMapper mapper = new HollowObjectMapper(writeStateEngine);

        // Lists cannot contain null elements
        try {
            mapper.add(new TypeWithList("a", null, "c"));
            Assert.fail("NullPointerException not thrown from List containing null elements");
        } catch (NullPointerException e) {
            String m = e.getMessage();
            Assert.assertNotNull(m);
            Assert.assertTrue(m.contains("Lists"));
        }

        // Sets cannot contain null elements
        try {
            mapper.add(new TypeWithSet("a", null, "c"));
            Assert.fail("NullPointerException not thrown from Set containing null elements");
        } catch (NullPointerException e) {
            String m = e.getMessage();
            Assert.assertNotNull(m);
            Assert.assertTrue(m.contains("Sets"));
        }

        // Maps cannot contain null keys
        try {
            mapper.add(new TypeWithMap("a", "a", null, "b", "c", "c"));
            Assert.fail("NullPointerException not thrown from Map containing null keys");
        } catch (NullPointerException e) {
            String m = e.getMessage();
            Assert.assertNotNull(m);
            Assert.assertTrue(m.contains("Maps"));
            Assert.assertTrue(m.contains("key"));
        }

        // Maps cannot contain null values
        try {
            mapper.add(new TypeWithMap("a", "a", "b", null, "c", "c"));
            Assert.fail("NullPointerException not thrown from Map containing null values");
        } catch (NullPointerException e) {
            String m = e.getMessage();
            Assert.assertNotNull(m);
            Assert.assertTrue(m.contains("Maps"));
            Assert.assertTrue(m.contains("value"));
        }
    }