My team doesn't write tests for generated code (e.g. some POJOs). An engineer that I greatly respect recently wrote this on the subject:
Research over the past 10 years has revealed that generated code is as prone to bugs as other code, and in many cases the bugs in generated code are far more costly to triage. Hence, the common recommendation regarding generated code is that it should be unit tested either by:
Generated unit tests (provided along-side the generated code)
Unit tests provided by the integration code
Most of the time #1 isn't available, but #2 above is usually intrinsic to the unit tests written for classes utilizing the generated code, and well written unit tests for the consuming/extended classes results in high coverage of the generated code.
This recommendation has been universally (more-or-less) picked up by the code coverage community, as evidenced by the fact that Cobertura's replacement, JaCoCo, does not even provide exclusions as an option.
I haven't been able to find research on this subject, but then again I'm not deep in to testing. Are there data on this question? If so, what are the implications?