Search in sources :

Example 1 with RenameProperty

use of org.simpleflatmapper.map.property.RenameProperty in project SimpleFlatMapper by arnaudroger.

the class AbstractMapperFactoryTest method testAliases.

@Test
public void testAliases() {
    MapperFactory mapperFactory = new MapperFactory();
    mapperFactory.addAlias("a", "aa");
    mapperFactory.addAliases(new HashMap<String, String>() {

        {
            put("b", "bb");
            put("c", "cc");
        }
    });
    Assert.assertArrayEquals(new Object[] { new RenameProperty("aa") }, mapperFactory.columnDefinitions().getColumnDefinition(new SampleFieldKey("a", 0)).properties());
    Assert.assertArrayEquals(new Object[] { new RenameProperty("bb") }, mapperFactory.columnDefinitions().getColumnDefinition(new SampleFieldKey("b", 0)).properties());
    Assert.assertArrayEquals(new Object[] { new RenameProperty("cc") }, mapperFactory.columnDefinitions().getColumnDefinition(new SampleFieldKey("c", 0)).properties());
    Assert.assertArrayEquals(new Object[] {}, mapperFactory.columnDefinitions().getColumnDefinition(new SampleFieldKey("d", 0)).properties());
}
Also used : RenameProperty(org.simpleflatmapper.map.property.RenameProperty) AbstractMapperFactory(org.simpleflatmapper.map.mapper.AbstractMapperFactory) SampleFieldKey(org.simpleflatmapper.test.map.SampleFieldKey) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 AbstractMapperFactory (org.simpleflatmapper.map.mapper.AbstractMapperFactory)1 RenameProperty (org.simpleflatmapper.map.property.RenameProperty)1 SampleFieldKey (org.simpleflatmapper.test.map.SampleFieldKey)1