use of org.simpleflatmapper.map.mapper.MapperBiFunctionAdapter in project SimpleFlatMapper by arnaudroger.
the class MapperBiFunctionAdapterTest method test.
@SuppressWarnings("unchecked")
@Test
public void test() throws Exception {
Predicate<Object> nullChecker = mock(Predicate.class);
Mapper<Object, String> mapper = mock(Mapper.class);
MappingContext mappingContext = mock(MappingContext.class);
MapperBiFunctionAdapter<Object, String> biFunctionAdapter = new MapperBiFunctionAdapter<Object, String>(mapper, nullChecker, 0);
Object o = new Object();
when(mapper.map(o, mappingContext)).thenReturn("HEllo", "Bye");
when(nullChecker.test(any())).thenReturn(false, true);
assertEquals("HEllo", biFunctionAdapter.apply(o, mappingContext));
assertNull(biFunctionAdapter.apply(null, null));
biFunctionAdapter.toString();
}
Aggregations