Search in sources :

Example 1 with BreakDetectorMappingContextFactory

use of org.simpleflatmapper.map.context.impl.BreakDetectorMappingContextFactory in project SimpleFlatMapper by arnaudroger.

the class MappingContextFactoryBuilderTest method testKeysAndSuppliers.

@Test
public void testKeysAndSuppliers() {
    builder.addSupplier(1, new ConstantSupplier<String>("hh"));
    builder.addKey(new SampleFieldKey("k1", 0));
    assertFalse(builder.hasNoKeys());
    MappingContextFactory<Object[]> mappingContextFactory = builder.newFactory();
    assertTrue(mappingContextFactory instanceof BreakDetectorMappingContextFactory);
    assertEquals("hh", mappingContextFactory.newContext().context(1));
    assertNull(mappingContextFactory.newContext().context(0));
}
Also used : BreakDetectorMappingContextFactory(org.simpleflatmapper.map.context.impl.BreakDetectorMappingContextFactory) SampleFieldKey(org.simpleflatmapper.test.map.SampleFieldKey) Test(org.junit.Test)

Example 2 with BreakDetectorMappingContextFactory

use of org.simpleflatmapper.map.context.impl.BreakDetectorMappingContextFactory in project SimpleFlatMapper by arnaudroger.

the class MappingContextFactoryBuilderTest method testKeys.

@Test
public void testKeys() throws Exception {
    builder.addKey(new SampleFieldKey("k1", 0));
    assertFalse(builder.hasNoKeys());
    MappingContextFactory<Object[]> mappingContextFactory = builder.newFactory();
    assertTrue(mappingContextFactory instanceof BreakDetectorMappingContextFactory);
    assertNull(mappingContextFactory.newContext().context(0));
    assertTrue(builder.nullChecker().test(new Object[] { null }));
    assertFalse(builder.nullChecker().test(new Object[] { 123 }));
}
Also used : BreakDetectorMappingContextFactory(org.simpleflatmapper.map.context.impl.BreakDetectorMappingContextFactory) SampleFieldKey(org.simpleflatmapper.test.map.SampleFieldKey) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 BreakDetectorMappingContextFactory (org.simpleflatmapper.map.context.impl.BreakDetectorMappingContextFactory)2 SampleFieldKey (org.simpleflatmapper.test.map.SampleFieldKey)2