### Question:
GroovyBeanSerializer implements Serializer { @Override public void serialize(EntityType model, SerializerConfig serializerConfig, CodeWriter writer) throws IOException { String simpleName = model.getSimpleName(); if (!model.getPackageName().isEmpty()) { writer.packageDecl(model.getPackageName()); } Set<String> importedClasses = getAnnotationTypes(model); if (model.hasLists()) { importedClasses.add(List.class.getName()); } if (model.hasCollections()) { importedClasses.add(Collection.class.getName()); } if (model.hasSets()) { importedClasses.add(Set.class.getName()); } if (model.hasMaps()) { importedClasses.add(Map.class.getName()); } writer.importClasses(importedClasses.toArray(new String[importedClasses.size()])); writer.javadoc(simpleName + javadocSuffix); for (Annotation annotation : model.getAnnotations()) { writer.annotation(annotation); } if (printSupertype && model.getSuperType() != null) { writer.beginClass(model, model.getSuperType().getType()); } else { writer.beginClass(model); } bodyStart(model, writer); for (Property property : model.getProperties()) { if (propertyAnnotations) { for (Annotation annotation : property.getAnnotations()) { writer.annotation(annotation); } } writer.field(property.getType(), property.getEscapedName()); } bodyEnd(model, writer); writer.end(); } GroovyBeanSerializer();  GroovyBeanSerializer(String javadocSuffix);  GroovyBeanSerializer(boolean propertyAnnotations);  GroovyBeanSerializer(boolean propertyAnnotations, String javadocSuffix); @Override void serialize(EntityType model, SerializerConfig serializerConfig,
            CodeWriter writer); void setPrintSupertype(boolean printSupertype);  }### Answer:
@Test public void properties() throws IOException { type.addProperty(new Property(type, "entityField", type)); type.addProperty(new Property(type, "collection", new SimpleType(Types.COLLECTION, typeModel))); type.addProperty(new Property(type, "listField", new SimpleType(Types.LIST, typeModel))); type.addProperty(new Property(type, "setField", new SimpleType(Types.SET, typeModel))); type.addProperty(new Property(type, "arrayField", new ClassType(TypeCategory.ARRAY, String[].class))); type.addProperty(new Property(type, "mapField", new SimpleType(Types.MAP, typeModel, typeModel))); for (Class<?> cl : Arrays.<Class<?>>asList(Boolean.class, Comparable.class, Integer.class, Date.class, java.sql.Date.class, java.sql.Time.class)) { Type classType = new ClassType(TypeCategory.get(cl.getName()), cl); type.addProperty(new Property(type, StringUtils.uncapitalize(cl.getSimpleName()), classType)); } GroovyBeanSerializer serializer = new GroovyBeanSerializer(); serializer.serialize(type, SimpleSerializerConfig.DEFAULT, new JavaWriter(writer)); String str = writer.toString(); for (String prop : Arrays.asList( "String[] arrayField;", "Boolean boolean$;", "Collection<DomainClass> collection;", "Comparable comparable;", "java.util.Date date;", "DomainClass entityField;", "Integer integer;", "List<DomainClass> listField;", "Map<DomainClass, DomainClass> mapField;", "Set<DomainClass> setField;", "java.sql.Time time;")) { assertTrue(prop + " was not contained", str.contains(prop)); } }