Tests and exception handling.