Search in sources :

Example 1 with StringConverter

use of io.atlasmap.converters.StringConverter in project atlasmap by atlasmap.

the class DefaultAtlasConversionServiceTest method findMatchingConverterByFieldTypes.

@Test
public void findMatchingConverterByFieldTypes() {
    assertNotNull(service);
    Optional<AtlasConverter<?>> atlasConverter = service.findMatchingConverter(FieldType.STRING, FieldType.BOOLEAN);
    assertTrue(atlasConverter.isPresent());
    assertNotNull(atlasConverter);
    assertEquals(StringConverter.class, atlasConverter.get().getClass());
    StringConverter stringConverter = (StringConverter) atlasConverter.get();
    assertNotNull(stringConverter);
    assertThat("io.atlasmap.converters.StringConverter", is(atlasConverter.get().getClass().getCanonicalName()));
    Boolean t = stringConverter.toBoolean("T", null, null);
    assertNotNull(t);
    assertTrue(t);
    Boolean f = stringConverter.toBoolean("F", null, null);
    assertNotNull(f);
    assertFalse(f);
    service.findMatchingConverter(null, FieldType.BOOLEAN);
    service.findMatchingConverter(FieldType.STRING, null);
    FieldType fieldType = null;
    service.findMatchingConverter(fieldType, fieldType);
}
Also used : AtlasConverter(io.atlasmap.api.AtlasConverter) StringConverter(io.atlasmap.converters.StringConverter) FieldType(io.atlasmap.v2.FieldType) Test(org.junit.Test)

Aggregations

AtlasConverter (io.atlasmap.api.AtlasConverter)1 StringConverter (io.atlasmap.converters.StringConverter)1 FieldType (io.atlasmap.v2.FieldType)1 Test (org.junit.Test)1