### Question:
PropertyUtils { private String toOneRelationshipDefinition(ObjRelationship relationship, boolean client) { StringUtils utils = StringUtils.getInstance(); String propertyType = EntityProperty.class.getName(); String propertyFactoryMethod = "createEntity"; String attributeType = getRelatedTypeName(relationship, client); return String.format("public static final %s<%s> %s = PropertyFactory.%s(\"%s\", %s.class);", importUtils.formatJavaType(propertyType), attributeType, utils.capitalizedAsConstant(relationship.getName()), propertyFactoryMethod, relationship.getName(), attributeType ); } PropertyUtils(ImportUtils importUtils);  PropertyUtils(ImportUtils importUtils,
                         AdhocObjectFactory adhocObjectFactory,
                         List<PropertyDescriptorCreator> propertyList,
                         Logger logger); void addImportForPK(EntityUtils entityUtils); void addImport(ObjAttribute attribute); void addImport(EmbeddedAttribute attribute); void addImport(EmbeddableAttribute attribute); void addImport(ObjRelationship relationship); void addImport(ObjRelationship relationship, boolean client); String propertyDefinition(ObjEntity entity, DbAttribute attribute); String propertyDefinition(ObjAttribute attribute, boolean client); String propertyDefinition(ObjAttribute attribute); String propertyDefinition(EmbeddedAttribute attribute); String propertyDefinition(EmbeddableAttribute attribute); String propertyDefinition(ObjRelationship relationship, boolean client); String propertyDefinition(ObjRelationship relationship); PropertyDescriptor getPropertyDescriptor(String attrType);  }### Answer:
@Test public void toOneRelationshipDefinition() { String typeName = "org.example.model.TargetEntity"; importUtils.addType(EntityProperty.class.getName()); importUtils.addType(typeName); ObjEntity entity = mock(ObjEntity.class); when(entity.getClassName()).thenReturn(typeName); when(entity.getName()).thenReturn("target"); ObjRelationship relationship = mock(ObjRelationship.class); when(relationship.isToMany()).thenReturn(false); when(relationship.getTargetEntityName()).thenReturn("target"); when(relationship.getName()).thenReturn("to_one_rel"); when(relationship.getTargetEntity()).thenReturn(entity); String definition = propertyUtils.propertyDefinition(relationship); assertEquals("public static final EntityProperty<TargetEntity> TO_ONE_REL = PropertyFactory.createEntity(\"to_one_rel\", TargetEntity.class);", definition); }