Add tests and add error test logic according to new tests.