@@ -0,0 +1,1865 @@
+/**%0D%0A * %0D%0A */%0D%0Apackage com.google.code.morphia.converters;%0D%0A%0D%0Aimport org.junit.Ignore;%0D%0Aimport org.junit.Test;%0D%0A%0D%0Aimport com.google.code.morphia.TestBase;%0D%0Aimport com.google.code.morphia.mapping.MappedField;%0D%0Aimport com.google.code.morphia.mapping.MappingException;%0D%0Aimport com.google.code.morphia.testutil.TestEntity;%0D%0A%0D%0A/**%0D%0A * @author Uwe Schaefer%0D%0A * %0D%0A */%0D%0Apublic class CustomConverterDefault extends TestBase %7B%0D%0A%09%0D%0A%09public static class E extends TestEntity %7B%0D%0A%09%09private static final long serialVersionUID = 1L;%0D%0A%09%09%0D%0A%09%09// FIXME issue 100 :%0D%0A%09%09// http://code.google.com/p/morphia/issues/detail?id=100%0D%0A%09%09// check default inspection: if not declared as property,%0D%0A%09%09// morphia fails due to defaulting to embedded and expecting a non-arg%0D%0A%09%09// constructor.%0D%0A%09%09//%0D%0A%09%09// @Property%0D%0A%09%09Foo foo = new Foo(%22test%22);%0D%0A%09%09%0D%0A%09%7D%0D%0A%09%0D%0A%09// unknown type to convert%0D%0A%09public static class Foo %7B%0D%0A%09%09private String string;%0D%0A%09%09%0D%0A%09%09public Foo(String string) %7B%0D%0A%09%09%09this.string = string;%0D%0A%09%09%7D%0D%0A%09%09%0D%0A%09%09@Override%0D%0A%09%09public String toString() %7B%0D%0A%09%09%09return string;%0D%0A%09%09%7D%0D%0A%09%7D%0D%0A%09%0D%0A%09public static class FooConverter extends TypeConverter %7B%0D%0A%09%09%0D%0A%09%09public boolean done;%0D%0A%09%09%0D%0A%09%09public FooConverter() %7B%0D%0A%09%09%09super(Foo.class);%0D%0A%09%09%7D%0D%0A%09%09%0D%0A%09%09@Override%0D%0A%09%09public Object decode(Class targetClass, Object fromDBObject, MappedField optionalExtraInfo)%0D%0A%09%09%09%09throws MappingException %7B%0D%0A%09%09%09return new Foo((String) fromDBObject);%0D%0A%09%09%7D%0D%0A%09%09%0D%0A%09%09@Override%0D%0A%09%09public Object encode(Object value, MappedField optionalExtraInfo) %7B%0D%0A%09%09%09done = true;%0D%0A%09%09%09return value.toString();%0D%0A%09%09%7D%0D%0A%09%09%0D%0A%09%09public boolean didConversion() %7B%0D%0A%09%09%09return done;%0D%0A%09%09%7D%0D%0A%09%7D%0D%0A%09%0D%0A%09@Test%0D%0A%09@Ignore%0D%0A%09public void testConversion() throws Exception %7B%0D%0A%09%09FooConverter fc = new FooConverter();%0D%0A%09%09morphia.getMapper().getConverters().addConverter(fc);%0D%0A%09%09E e = new E();%0D%0A%09%09ds.save(e);%0D%0A%09%09%0D%0A%09%09junit.framework.Assert.assertTrue(fc.didConversion());%0D%0A%09%7D%0D%0A%09%0D%0A%7D%0D%0A

Test for issue 100