### Question:
HibernateSearchPropertyHelper extends ReflectionPropertyHelper { @Override public Object convertToPropertyType(Class<?> entityType, String[] propertyPath, String value) { IndexValueFieldDescriptor fieldDescriptor = getValueFieldDescriptor(entityType, propertyPath); if (fieldDescriptor == null) { return super.convertToPropertyType(entityType, propertyPath, value); } Class<?> type = fieldDescriptor.type().dslArgumentClass(); if (!(Date.class.equals(type))) { return super.convertToPropertyType(entityType, propertyPath, value); } try { return DateTools.stringToDate(value); } catch (ParseException e) { throw new ParsingException(e); } } HibernateSearchPropertyHelper(SearchMapping searchMapping, EntityNameResolver<Class<?>> entityNameResolver); @Override Object convertToPropertyType(Class<?> entityType, String[] propertyPath, String value); @Override Class<?> getPrimitivePropertyType(Class<?> entityType, String[] propertyPath); @Override boolean isRepeatedProperty(Class<?> entityType, String[] propertyPath); @Override boolean hasEmbeddedProperty(Class<?> entityType, String[] propertyPath); @Override boolean hasProperty(Class<?> entityType, String[] propertyPath); @Override IndexedFieldProvider<Class<?>> getIndexedFieldProvider(); static String KEY; static String VALUE; }### Answer:
@Test public void testConvertIdProperty() { assertThat(convertToPropertyType(TestEntity.class, "id", "42")).isEqualTo("42"); }
@Test public void testConvertStringProperty() { assertThat(convertToPropertyType(TestEntity.class, "name", "42")).isEqualTo("42"); }
@Test public void testConvertIntProperty() { assertThat(convertToPropertyType(TestEntity.class, "i", "42")).isEqualTo(42); }
@Test public void testConvertLongProperty() { assertThat(convertToPropertyType(TestEntity.class, "l", "42")).isEqualTo(42L); }
@Test public void testConvertFloatProperty() { assertThat(convertToPropertyType(TestEntity.class, "f", "42.0")).isEqualTo(42.0F); }
@Test public void testConvertDoubleProperty() { assertThat(convertToPropertyType(TestEntity.class, "d", "42.0")).isEqualTo(42.0D); }