void (@NotNull Element expected, @NotNull Element actual) { assertTrue( String.format("Tag name mismatch - expected: '%s', actual: '%s'", expected.getName(), actual.getName()), Objects.equals(expected.getName(), actual.getName()) ); List children1 = expected.getChildren(); List children2 = actual.getChildren(); assertEquals(children1.size(), children2.size()); if (children1.isEmpty()) { assertTrue( String.format("Content mismatch - expected: '%s', actual: '%s'", expected.getText(), actual.getText()), Objects.equals(expected.getText(), actual.getText()) ); } else { for (int i = 0; i < children1.size(); i++) { checkElements((Element)children1.get(i), (Element)children2.get(i)); } } }