### Question:
FormEditorHelper { public FieldDefinition getFormField(String fieldId) { FieldDefinition result = content.getDefinition().getFieldById(fieldId); if (result == null) { result = availableFields.get(fieldId); if (result == null) { if (unbindedFields.containsKey(fieldId)) { Pair<EditorFieldLayoutComponent, FieldDefinition> pair = unbindedFields.get(fieldId); result = pair.getK2(); result.setLabel(result.getFieldType().getTypeName()); if (result instanceof HasPlaceHolder) { ((HasPlaceHolder) result).setPlaceHolder(result.getFieldType().getTypeName()); } unbindedFields.remove(result.getId()); FieldDefinition newField = fieldManager.getDefinitionByFieldType(result.getFieldType()); newField.setName(generateUnboundFieldName(newField)); EditorFieldLayoutComponent component = pair.getK1(); component.init(content.getRenderingContext(), newField); unbindedFields.put(newField.getId(), new Pair<>(component, newField)); } } } return result; } @Inject  FormEditorHelper(FieldManager fieldManager,
                            ManagedInstance<EditorFieldLayoutComponent> editorFieldLayoutComponents,
                            SyncBeanManager beanManager); FormModelerContent getContent(); void initHelper(FormModelerContent content); FormDefinition getFormDefinition(); FormModel getFormModel(); void addAvailableFields(); void addAvailableField(FieldDefinition field); void removeAvailableField(FieldDefinition field); FieldDefinition getFormField(String fieldId); void removeField(String fieldId,
                            boolean addToAvailables); boolean modelContainsField(FieldDefinition fieldDefinition); List<String> getCompatibleModelFields(FieldDefinition field); List<String> getCompatibleFieldTypes(FieldDefinition field); FieldDefinition switchToField(FieldDefinition originalField,
                                         String newBinding); FieldDefinition switchToFieldType(FieldDefinition field,
                                             String fieldCode); void saveFormField(FieldDefinition originalField,
                              FieldDefinition fieldCopy); String generateUnboundFieldName(FieldDefinition field); Collection<EditorFieldLayoutComponent> getBaseFieldsDraggables(); Map<String, FieldDefinition> getAvailableFields(); FormEditorRenderingContext getRenderingContext(); @PreDestroy void destroy(); static final String UNBOUND_FIELD_NAME_PREFFIX; }### Answer:
@Test public void testGetFormField() { when(formDefinition.getFieldById(anyString())).thenReturn(nameField); content.setDefinition(formDefinition); FieldDefinition formField = formEditorHelper.getFormField(nameField.getId()); assertEquals(formField, nameField); }