@Test
 public void testConversionInList() throws Exception {
   final FooConverter fc = new FooConverter();
   getMorphia().getMapper().getConverters().addConverter(fc);
   final E1 e = new E1();
   e.foo.add(new Foo("bar"));
   getDs().save(e);
   Assert.assertTrue(fc.didConversion());
 }
  @Test
  public void testConversionInMap() throws Exception {
    final FooConverter fc = new FooConverter();
    getMorphia().getMapper().getConverters().addConverter(fc);
    E2 e = new E2();
    e.foo.put("bar", new Foo("bar"));
    getDs().save(e);

    Assert.assertTrue(fc.didConversion());

    e = getDs().find(E2.class).get();
    Assert.assertNotNull(e.foo);
    Assert.assertFalse(e.foo.isEmpty());
    Assert.assertTrue(e.foo.containsKey("bar"));
    Assert.assertEquals("bar", e.foo.get("bar").string);
  }