Added exception in classes and tests