Added ability to exclude simple getters/setters

 

In TDD, programmers are usually advised not to test things that are "too simple to be broken", since there is no point in testing code that has no bugs.  While for totally green beginners there may be merit to testing even the simplest of methods, for seasoned programmers there isn't much point.

To this end, I enhanced the JavaTddPlugin with a new option that allows simple getter and setter methods to be excluded from mandatory code coverage, meaning students would not have to write explicit tests for them.  A simple getter is a public method with a name beginning with "get" that takes no parameters and returns a result.  Further, the simple getter can only contain one statement: a simple return statement that returns a field (or any dotted name, really).  A simple setter is a public void method with a name beginning with "set" that takes a single parameter, where the body is a single assignment statement assigning the parameter to a field (or any dotted name, really).

By default, these methods are now excluded from coverage requirements, although instructors can explicitly turn on requirements for them in the plug-in's options.  I still haven't pushed this change to the publicly released version of the plug-in, but it will go out in the next version (it is currently running on VT's production server).

Groups: