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));
}
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 }));
}
Aggregations