I have been tasked to increase code coverage of an existing Java project.
I noticed that the code coverage tool (EclEmma) has highlighted some methods that are never called from anywhere.
My initial reaction is not to write unit tests for these methods, but to highlight them to my line manager/team and ask why these functions are there to begin with.
What would the best approach be? Write unit tests for them, or question why they're there?
Best Answer
Rationale:
rareunique event that someone comes around later looking for that code it can be retrieved.Caveat from comments: The original answer assumed that you had thoroughly verified that the code is, beyond doubt, dead. IDEs are fallible, and there are several ways in which code which looks dead might in fact be called. Bring in an expert unless you're absolutely sure.