### Question:
FieldModel extends Config { public FieldModel fill(final FieldModel fieldModel) { final Map<String, FieldValueModel> fieldValueModelMap = new HashMap<>(); fieldValueModelMap.putAll(getKeyToValues()); final Map<String, FieldValueModel> fieldsToAdd = fieldModel.getKeyToValues(); for (final Map.Entry<String, FieldValueModel> entry : fieldsToAdd.entrySet()) { final String key = entry.getKey(); if (!fieldValueModelMap.containsKey(key) || fieldValueModelMap.get(key).getValue().isEmpty()) { fieldValueModelMap.put(key, entry.getValue()); } } final String modelDescriptorName = StringUtils.isNotBlank(getDescriptorName()) ? getDescriptorName() : fieldModel.getDescriptorName(); final String modelContext = StringUtils.isNotBlank(getContext()) ? getContext() : fieldModel.getContext(); final String modelCreatedAt = StringUtils.isNotBlank(getCreatedAt()) ? getCreatedAt() : fieldModel.getCreatedAt(); final String modelLastUpdated = StringUtils.isNotBlank(getLastUpdated()) ? getLastUpdated() : fieldModel.getLastUpdated(); final FieldModel newFieldModel = new FieldModel(modelDescriptorName, modelContext, modelCreatedAt, modelLastUpdated, fieldValueModelMap); final String id = StringUtils.isNotBlank(getId()) ? getId() : fieldModel.getId(); newFieldModel.setId(id); return newFieldModel; } private  FieldModel();  FieldModel(String descriptorName, String context, Map<String, FieldValueModel> keyToValues);  FieldModel(String configId, String descriptorName, String context, Map<String, FieldValueModel> keyToValues);  FieldModel(String descriptorName, String context, String createdAt, String lastUpdated, Map<String, FieldValueModel> keyToValues);  FieldModel(String configId, String descriptorName, String context, String createdAt, String lastUpdated, Map<String, FieldValueModel> keyToValues); String getDescriptorName(); String getContext(); String getCreatedAt(); String getLastUpdated(); Map<String, FieldValueModel> getKeyToValues(); void setKeyToValues(final Map<String, FieldValueModel> keyToValues); Optional<FieldValueModel> getFieldValueModel(final String key); Optional<String> getFieldValue(final String key); void putField(final String key, final FieldValueModel field); void removeField(final String key); FieldModel fill(final FieldModel fieldModel);  }### Answer:
@Test public void fillTest() { String descriptor = "description1"; String context = "context1"; String key = "Key1"; String configId = "Id1"; String createdAt = "2020-01-22-14-11-20-124"; String lastUpdated = "2020-01-1"; FieldValueModel testFieldValueModel = Mockito.mock(FieldValueModel.class); Map<String, FieldValueModel> keyToValues = new HashMap<>(); keyToValues.put(key, testFieldValueModel); FieldModel testFieldModel = new FieldModel(configId, descriptor, context, createdAt, lastUpdated, keyToValues); FieldModel newTestFieldModel = testFieldModel.fill(testFieldModel); assertEquals(testFieldModel, newTestFieldModel); assertFalse(testFieldModel == newTestFieldModel); assertEquals(descriptor, newTestFieldModel.getDescriptorName()); assertEquals(context, newTestFieldModel.getContext()); assertTrue(newTestFieldModel.getKeyToValues().containsKey(key)); assertEquals(configId, newTestFieldModel.getId()); assertEquals(createdAt, newTestFieldModel.getCreatedAt()); assertEquals(lastUpdated, newTestFieldModel.getLastUpdated()); }