public static synchronized @Nonnull Map<String, Object> loadYamlFile(File file)
            throws Exception {
        try (FileInputStream inputStream = new FileInputStream((file))) {
            Map<String, Object> yamlResult =
                    (Map<String, Object>) loader.loadFromInputStream(inputStream);
            return yamlResult == null ? new HashMap<>() : yamlResult;
        } catch (FileNotFoundException e) {
            LOG.error("Failed to find YAML file", e);
            throw e;
        } catch (IOException | YamlEngineException e) {
            if (e instanceof MarkedYamlEngineException) {
                YamlEngineException exception =
                        wrapExceptionToHiddenSensitiveData((MarkedYamlEngineException) e);
                LOG.error("Failed to parse YAML configuration", exception);
                throw exception;
            } else {
                throw e;
            }
        }
    }
@Test
    void testLoadEmptyYamlFile() throws Exception {
        File confFile = new File(tmpDir, "test.yaml");
        confFile.createNewFile();

        assertThat(YamlParserUtils.loadYamlFile(confFile)).isEmpty();
    }