sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Ryan <>
Subject [unit testing] HtmlRenderer error cases
Date Fri, 03 Feb 2017 23:29:31 GMT

As I'm in the process of adding unit tests for HtmlRenderer, I'm wondering
about some cases that could arguably be error conditions.

For example, if I have an HtmlRenderer instance and I call the "link()"
method with an empty string passed in as the info parameter, the method
will faithfully generate an anchor tag that is not wrapped around any
text.  Likewise, if I call the "link()" method with an empty string passed
in as the url parameter, it will also generate an anchor tag with an empty
string value for the href.

Do we prefer to make these methods accept as many inputs as possible, or
would we like to make use of e.g. IllegalArgumentException to indicate when
the method is being invoked in a way that doesn't make sense?

I just want to know the general feeling, so I can consistently enforce it
via the unit tests I'm writing.


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message