@Test public void Prefix_Only() { QueryTypeFactory factory = new QueryTypeFactoryImpl("Q", "", ""); assertEquals("com.mysema.query.codegen.QPoint", factory.create(type).getFullName()); }
@Test public void GetPathType_Of_InnerClass() { TypeMappings typeMappings = new JavaTypeMappings(); EntityType model = new EntityType(new ClassType(TypeMappingsTest.class)); EntityType type = new EntityType(new ClassType(Entity.class)); typeMappings.register(type, new QueryTypeFactoryImpl("Q","","").create(type)); Type pathType = typeMappings.getPathType(type, model, false); assertEquals("QTypeMappingsTest_Entity", pathType.getSimpleName()); }
@Test public void Prefix_And_Suffix() { QueryTypeFactory factory = new QueryTypeFactoryImpl("Q", "Type", ""); assertEquals("com.mysema.query.codegen.QPointType", factory.create(type).getFullName()); }
@Test public void Prefix_And_Package_Suffix() { QueryTypeFactory factory = new QueryTypeFactoryImpl("Q", "", ".query"); assertEquals("com.mysema.query.codegen.query.QPoint", factory.create(type).getFullName()); }
@Test public void Suffix_Only() { QueryTypeFactory factory = new QueryTypeFactoryImpl("", "Type", ""); assertEquals("com.mysema.query.codegen.PointType", factory.create(type).getFullName()); }
@Test public void Different_Package() throws IOException { queryTypeFactory = new QueryTypeFactoryImpl("Q", "", ".gen"); EntityType entityType = new EntityType(new ClassType(Entity.class)); typeMappings.register(entityType, queryTypeFactory.create(entityType)); serializer.serialize(entityType, SimpleSerializerConfig.DEFAULT, new JavaWriter(writer)); // System.err.println(writer.toString()); assertTrue(writer.toString().contains("public class QEntitySerializerTest_Entity " + "extends EntityPathBase<EntitySerializerTest.Entity>")); }