Throw exceptions for tests instead of returning null