There are different strategies:
* Use mocking to test those exceptions (assuming you have a proper
delegate which can be mocked)
* Change your exception hierarchies or method signatures to avoid such
catch blocks
On 2017-11-14 07:41, Ran Cohen wrote:
> In the mean time - what can I do? How can I test catch-blocks that would
> rarely occur (and are almost impossible to replicate)?
>
> On Tuesday, November 14, 2017 at 8:35:55 AM UTC+2, Marc R. Hoffmann wrote:
>
> Hi Ran,
>
> JaCoCo does not have an option to exclude parts of a method. We have an open
> feature request for this:
>
> https://github.com/jacoco/jacoco/issues/14 [1]
>
> For a couple of reasons it is very unlikely that such functionality will be
> added to JaCoCo soon.
>
> Regards,
> -marc
>
> On 2017-11-13 14:30, Ran Cohen wrote:
> I have general catch blocks, that attached to exceptions almost impossibly
> thrown.
> Because its almost impossible to cause an exception, and also because they
> just re-throw the exception, I don't test them, but Jacoco marks the catch
> block as not tested, which is ugly...
> How can I tell Jacoco to ignore this blocks (or any other code for that
> matter)?
>
> --
> You received this message because you are subscribed to the Google Groups
> "JaCoCo and EclEmma Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jacoco/0343570e-0e32-4004-b2b3-55afedd4c280%40googlegroups.com
> [2].
> For more options, visit https://groups.google.com/d/optout [3].
--
You received this message because you are subscribed to the Google
Groups "JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jacoco/d29ffbe7-1fec-4653-907d-fcb99b7c061b%40googlegroups.com
[4].
For more options, visit https://groups.google.com/d/optout.
Links:
------
[1] https://github.com/jacoco/jacoco/issues/14
[2]
https://groups.google.com/d/msgid/jacoco/0343570e-0e32-4004-b2b3-55afedd4c280%40googlegroups.com?utm_medium=email&utm_source=footer
[3] https://groups.google.com/d/optout
[4]
https://groups.google.com/d/msgid/jacoco/d29ffbe7-1fec-4653-907d-fcb99b7c061b%40googlegroups.com?utm_medium=email&utm_source=footer
--
You received this message because you are subscribed to the Google Groups
"JaCoCo and EclEmma Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jacoco/6212299d4654beb257621270fbb8d48d%40mountainminds.com.
For more options, visit https://groups.google.com/d/optout.