Search code examples
javajunitintellij-ideaassert

How to assert for valid HTML per jUnit


I have a junit test that I need to validate for valid html.

Is there an assertValidHtml() or will I have to use something like jsoup then validate on that return value?


Solution

  • Junit does not include an HTML parser or validator by itself. So yes, use something like jsoup to parse and validate your html and then do asserts on the result.