Modifies code and test for consistency

This version of the test cases uses the Hamcrest matchers instead of
the old assertEquals matcher.

In addition, the class has been updated with additional comments.