Add tests

* Renamed exception name from e to err
* Added tests for invalid criteria