|
Groovy example source code file (MixedMarkupTestSupport.groovy)
The Groovy MixedMarkupTestSupport.groovy source codepackage groovy.xml class MixedMarkupTestSupport { private static def mixedXml = ''' <p>Please read the Home page ''' static void checkMixedMarkup(Closure getRoot) { def root = getRoot(mixedXml) assert root != null def children = root.children() if (isSlurper(root)) { assert children.size() == 1 assert children[0].name() == 'a' } else { assert children.size() == 3 assert children[1].name() == 'a' if (isParser(root)) { assert children[2] == 'page' } else { assert children[2].text() == 'page' } } } private static boolean isSlurper(node) { return node.getClass().name.contains('slurper') } private static boolean isParser(node) { return (node instanceof groovy.util.Node) } private static boolean isDom(node) { return node.getClass().name.contains('Element') } } Other Groovy examples (source code examples)Here is a short list of links related to this Groovy MixedMarkupTestSupport.groovy source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.