public static YamlMapping asMapping(YamlNode node) {
        if (node != null && !(node instanceof YamlMapping)) {
            String nodeName = node.nodeName();
            throw new YamlException(String.format("Child %s is not a mapping, it's actual type is %s",
                    nodeName, node.getClass()));
        }

        return (YamlMapping) node;
    }
@Test(expected = YamlException.class)
    public void asMappingThrowsIfNonMappingPassed() {
        YamlNode genericNode = new YamlSequenceImpl(null, "sequence");
        YamlUtil.asMapping(genericNode);
    }