added InvalidArgumentException and added test