@Test void pathsAreClosed() { final String error = doValidate("closedpath", 1).iterator().next(); assertTrue(error.startsWith("[closedpath.svg] All path must be closed so end with 'z', found value:"), error); }
private String pathsAreClosed(final SVGOMSVGElement icon) { return browseDom(icon, node -> { if ("path".equals(node.getNodeName())) { final Node d = node.getAttributes() == null ? null : node.getAttributes().getNamedItem("d"); if (d == null || d.getNodeValue() == null) { return "Missing 'd' in a path"; } if (!d.getNodeValue().toLowerCase(Locale.ROOT).endsWith("z")) { return "All path must be closed so end with 'z', found value: '" + d.getNodeValue() + '\''; } } return null; }); }
SvgValidator { private String pathsAreClosed(final SVGOMSVGElement icon) { return browseDom(icon, node -> { if ("path".equals(node.getNodeName())) { final Node d = node.getAttributes() == null ? null : node.getAttributes().getNamedItem("d"); if (d == null || d.getNodeValue() == null) { return "Missing 'd' in a path"; } if (!d.getNodeValue().toLowerCase(Locale.ROOT).endsWith("z")) { return "All path must be closed so end with 'z', found value: '" + d.getNodeValue() + '\''; } } return null; }); } }
SvgValidator { private String pathsAreClosed(final SVGOMSVGElement icon) { return browseDom(icon, node -> { if ("path".equals(node.getNodeName())) { final Node d = node.getAttributes() == null ? null : node.getAttributes().getNamedItem("d"); if (d == null || d.getNodeValue() == null) { return "Missing 'd' in a path"; } if (!d.getNodeValue().toLowerCase(Locale.ROOT).endsWith("z")) { return "All path must be closed so end with 'z', found value: '" + d.getNodeValue() + '\''; } } return null; }); }  }
SvgValidator { private String pathsAreClosed(final SVGOMSVGElement icon) { return browseDom(icon, node -> { if ("path".equals(node.getNodeName())) { final Node d = node.getAttributes() == null ? null : node.getAttributes().getNamedItem("d"); if (d == null || d.getNodeValue() == null) { return "Missing 'd' in a path"; } if (!d.getNodeValue().toLowerCase(Locale.ROOT).endsWith("z")) { return "All path must be closed so end with 'z', found value: '" + d.getNodeValue() + '\''; } } return null; }); }  Stream<String> validate(final Path path); }
SvgValidator { private String pathsAreClosed(final SVGOMSVGElement icon) { return browseDom(icon, node -> { if ("path".equals(node.getNodeName())) { final Node d = node.getAttributes() == null ? null : node.getAttributes().getNamedItem("d"); if (d == null || d.getNodeValue() == null) { return "Missing 'd' in a path"; } if (!d.getNodeValue().toLowerCase(Locale.ROOT).endsWith("z")) { return "All path must be closed so end with 'z', found value: '" + d.getNodeValue() + '\''; } } return null; }); }  Stream<String> validate(final Path path);  }