I have a server-local.yml file which has a boolean flag with values with either true or false:
isFruitSweet: ${IS_FRUIT_SWEET:- true}
And in the Test Class, I am calling the .yml file variable/key as follows:
private Boolean isFruitSweetCheck = Boolean.parseBoolean(System.getenv("IS_FRUIT_SWEET"));
And in test I am referring the declarations as:
`@Test
void fruitTest() {
InputStream ymlReader = new FileInputStream(“src/yml/server-local.yml”);
Yaml yaml = new Yaml();
Map<String, Object> yamlMaps = yaml.load(ymlReader);
LOG.info(“Is the fruit sweet: “, yamlMaps.get(“IS_FRUIT_SWEET”));
}`
I even tried adding EVN Var in the Run Configuration of the Application to have the flag ‘IS_FRUIT_SWEET’ as either true or false.
But each operation results in value showing up as null. Any help is appreciated.
It should return the boolean flag value as true or false. But rather is always showing up as null.