Fixed incorrect exceptions in unit tests.