Call to iterator next() was not throwing the right exception.
Merge pull request #5 from Nomeasmo/master

Call to iterator next() was not throwing the right exception.
Merge pull request #4 from MRCY/master

Added constructor that accepts a DB object, to facilitate mocking.