### Question:
AnnotationMapper implements Mapper<Object> { @Override public Map<Path<?>, Object> createMap(RelationalPath<?> path, Object object) { try { Map<String, Path<?>> columnToPath = new HashMap<String, Path<?>>(); for (Path<?> column : path.getColumns()) { columnToPath.put(ColumnMetadata.getName(column), column); } Map<Path<?>, Object> values = new HashMap<Path<?>, Object>(); for (Field field : ReflectionUtils.getFields(object.getClass())) { Column ann = field.getAnnotation(Column.class); if (ann != null) { field.setAccessible(true); Object propertyValue = field.get(object); if (propertyValue != null) { if (columnToPath.containsKey(ann.value())) { values.put(columnToPath.get(ann.value()), propertyValue); } } else if (withNullBindings) { values.put(columnToPath.get(ann.value()), Null.DEFAULT); } } } return values; } catch (IllegalAccessException e) { throw new QueryException(e); } } AnnotationMapper();  AnnotationMapper(boolean withNullBindings); @Override Map<Path<?>, Object> createMap(RelationalPath<?> path, Object object); static final AnnotationMapper DEFAULT; static final AnnotationMapper WITH_NULL_BINDINGS; }### Answer:
@Test public void extract_success() { EmployeeNames names = new EmployeeNames(); names._id = 9; names._firstname = "A"; names._lastname = "B"; Map<Path<?>, Object> values = AnnotationMapper.DEFAULT.createMap(emp, names); assertEquals(3, values.size()); assertEquals(names._id, values.get(emp.id)); assertEquals(names._firstname, values.get(emp.firstname)); assertEquals(names._lastname, values.get(emp.lastname)); }
@Test public void extract_failure() { Map<Path<?>, Object> values = AnnotationMapper.DEFAULT.createMap(emp, employee); assertTrue(values.isEmpty()); }
@Test public void extract2() { Map<Path<?>, Object> values = AnnotationMapper.DEFAULT.createMap(emp, new EmployeeX()); assertTrue(values.isEmpty()); }