### Question:
AppConfigBaseModel { public Object getCurrentValue(String value) { Method[] methods = getClass().getDeclaredMethods(); Object result = null; boolean foundMethod = false; for (Method method : methods) { String getMethod = "get" + value.substring(0, 1).toUpperCase() + value.substring(1); String isMethod = "is" + value.substring(0, 1).toUpperCase() + value.substring(1); if (method.getName().equals(getMethod) || method.getName().equals(isMethod)) { Class noParams[] = {}; try { result = method.invoke(this, (Object[])noParams); } catch (IllegalAccessException ignored) { } catch (InvocationTargetException ignored) { } foundMethod = true; } } if (!foundMethod) { Field[] fields = getClass().getDeclaredFields(); for (Field field : fields) { try { if (field.getName().equals(value)) { result = field.get(this); break; } } catch (IllegalAccessException ignored) { } } } return result; }  ArrayList<String> configurationValueList(); ArrayList<String> globalValueList(); ArrayList<String> getConfigurationCategories(); ArrayList<String> getGlobalCategories(); boolean valueBelongsToCategory(String value, String category); Object getCurrentValue(String value); void applyCustomSettings(String configName, AppConfigStorageItem item);  }### Answer:
@Test public void testGetCurrentValueForFields() { DerivedModelWithFields model = new DerivedModelWithFields(); model.simpleEnumField = SimpleEnum.Value; model.complexEnumField = ComplexEnum.Test; model.stringField = "Test string"; model.longField = -3948; model.intField = 834892; model.boolField = true; Assert.assertEquals(SimpleEnum.Value, model.getCurrentValue("simpleEnumField")); Assert.assertEquals(ComplexEnum.Test, model.getCurrentValue("complexEnumField")); Assert.assertEquals("Test string", model.getCurrentValue("stringField")); Assert.assertEquals((long)-3948, model.getCurrentValue("longField")); Assert.assertEquals(834892, model.getCurrentValue("intField")); Assert.assertEquals(true, model.getCurrentValue("boolField")); }
@Test public void testGetCurrentValueForMethods() { DerivedModelWithMethods model = new DerivedModelWithMethods(); model.setSimpleEnumField(SimpleEnum.Name); model.setComplexEnumField(ComplexEnum.Application); model.setStringField("Another test"); model.setLongField(92345); model.setIntField(-234); model.setBoolField(false); Assert.assertEquals(SimpleEnum.Name, model.getCurrentValue("simpleEnumField")); Assert.assertEquals(ComplexEnum.Application, model.getCurrentValue("complexEnumField")); Assert.assertEquals("Another test", model.getCurrentValue("stringField")); Assert.assertEquals((long)92345, model.getCurrentValue("longField")); Assert.assertEquals(-234, model.getCurrentValue("intField")); Assert.assertEquals(false, model.getCurrentValue("boolField")); }