@Test public void removeFieldTest() { String descriptor = "description1"; String context = "context1"; String keyValid = "Key1"; String keyToDelete = "Key2"; FieldValueModel testFieldValueModel = Mockito.mock(FieldValueModel.class); Map<String, FieldValueModel> keyToValues = new HashMap<>(); keyToValues.put(keyValid, testFieldValueModel); keyToValues.put(keyToDelete, testFieldValueModel); FieldModel testFieldModel = new FieldModel(descriptor, context, keyToValues); Map<String, FieldValueModel> testKeyToValues = testFieldModel.getKeyToValues(); assertTrue(testKeyToValues.containsKey(keyValid)); assertTrue(testKeyToValues.containsKey(keyToDelete)); testFieldModel.removeField(keyToDelete); testKeyToValues = testFieldModel.getKeyToValues(); assertTrue(testKeyToValues.containsKey(keyValid)); assertFalse(testKeyToValues.containsKey(keyToDelete), "The keyToDelete was not successfully removed."); }
public void removeField(final String key) { keyToValues.remove(key); }
FieldModel extends Config { public void removeField(final String key) { keyToValues.remove(key); } }
FieldModel extends Config { public void removeField(final String key) { keyToValues.remove(key); } 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); }
FieldModel extends Config { public void removeField(final String key) { keyToValues.remove(key); } 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); }
FieldModel extends Config { public void removeField(final String key) { keyToValues.remove(key); } 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);  }