Clover coverage results

Published by Rob on July 16th, 2003 - in Java

I have just started using clover on site. The Clover IntelliJ plug-in is cool, and makes for some great fun when working through and increasing test coverage.

Sometimes, however it can be hard to test the last couple of statements on a class.

I am really going to struggle to get the encoding exception on this bit of code tested….

try {
   stringBytes= string.trim().getBytes(“UTF-8″);
} catch (UnsupportedEncodingException e) {
   log.error(“This error is suprising — we really expect any jvm to support the UTF-8 encoding “+ e.getMessage(), e);
}

No related posts.


2 Responses

  1. Philippe says:

    Good point but in a way maybe this is pointing out that the test is inappropriate ?
    Should you really be testing the JVM capabilities in a unit-test (I am assuming this is what you are doing)? Isn’t it a test for the QA department or for a preproduction environement.

    Are you sure that your tests will be running in the same JVM as the production env ? If not then the test is meaningless, if so then you already know what the JVM is capable of.

    Just my 2 cents (I ran into similar problems related to unix locales some time ago !)

  2. Anonymous says:

    I think you can get Clover to ignore catch statements. I’ve had the same problem. Virtually my only complaint about Clover, it’s a great tool!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

© Rob@Rojotek