modified to use Hamcrest.