### Question:
EnvironmentVariableUtils { public static <C> C newConfigurationInstance(Class<C> configurationClazz) { Objects.requireNonNull(configurationClazz); Utils.require(configurationClazz, FunctionalUtils.not(Class::isInterface), () -> new IllegalArgumentException("Specified class is an interface : " + configurationClazz.toString())); try { C configuration = configurationClazz.getConstructor().newInstance(); Arrays.stream(configurationClazz.getFields()) .forEach(field -> fieldSetFromEnvVal(field, configuration)); return configuration; } catch (ReflectiveOperationException e) { throw new RuntimeException(e); } } private  EnvironmentVariableUtils(); static C newConfigurationInstance(Class<C> configurationClazz);  }### Answer:
@Test public void newConfigurationInstanceTest() { TestConfig config = EnvironmentVariableUtils.newConfigurationInstance(TestConfig.class); assertEquals("string_value", config.TEST_STRING_VALUE); assertEquals(Integer.valueOf(1), config.TEST_INTEGER_VALUE); assertEquals(1, config.TEST_INT_VALUE); assertEquals(Boolean.FALSE, config.TEST_BOOLEAN_VALUE); assertEquals(false, config.TEST_BOOL_VALUE); assertEquals("not_exists", config.TEST_NOT_EXIST_VALUE); }
@Test public void newConfigurationInstanceNotSupportedTest() { expectedException.expect(RuntimeException.class); EnvironmentVariableUtils.newConfigurationInstance(TestConfigNotSupported.class); }