@Test
public void testToTypeFunction() {

    String value = "123.45D";
    Object result;
    try {
        // String value.
        result = convertFromString(String.class, value, Collections.emptyMap());
        assertEquals("Wrong return converterName", String.class, result.getClass());
        // Double value.
        result = convertFromString(Double.class, value, Collections.emptyMap());
        assertEquals("Wrong return converterName", Double.class, result.getClass());
        // BigDecimal value.
        result = convertFromString(BigDecimal.class, value, Collections.emptyMap());
        assertEquals("Wrong return converterName", BigDecimal.class, result.getClass());
        // Float value.
        result = convertFromString(Float.class, value, Collections.emptyMap());
        assertEquals("Wrong return converterName", Float.class, result.getClass());
        // Long value.
        value = "12345";
        result = convertFromString(Long.class, value, Collections.emptyMap());
        assertEquals("Wrong return converterName", Long.class, result.getClass());
        // Integer value.
        value = "12345";
        result = convertFromString(Integer.class, value, Collections.emptyMap());
        assertEquals("Wrong return converterName", Integer.class, result.getClass());
        // Date value.
        value = "06/16/2016";
        Map<String, ConversionOptionBO> options = new HashMap<>(1);
        options.put("format", new ConversionOptionBO("format", "MM/dd/yyyy"));
        result = convertFromString(Date.class, value, options);
        assertEquals("Wrong return converterName", Date.class, result.getClass());
    } catch (Exception e) {
        e.printStackTrace();
        fail("Failed to convert: " + value + ": " + e.getMessage());
    }
}