class YamlFixtureParser implements FixtureParser {

    @SuppressWarnings("unchecked")
    @Override
    public Map<String, FixtureMap> parse(String fixture) {
        Map<String, ? extends Object> fixtures = buildYaml().loadAs(fixture, Map.class);;
        Map<String, FixtureMap> fixtureMaps = new HashMap<>();

        for (String key : fixtures.keySet()) {
            if (fixtures.get(key) instanceof Map) {
                FixtureMap fixtureMap = FixtureTemplateWrapper.wrap((Map) fixtures.get(key), key, null);
                fixtureMap.setRoot(true);
                fixtureMaps.put(key, fixtureMap);
            } else {
                throw new FixtureFormatException(key, " the root of fixture data should be key - value");
            }
        }

        return fixtureMaps;
    }

}