Product Development in Brisbane

Clover coverage results

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);
}

2 Responses to “Clover coverage results”

  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