8. Exceptions and Assertions
Main steps
- Investigate jtm.activity08 package
- Create class SimpleCalcException as a subclass of Exception
- Implement following constructors for this class:
- SimpleCalcException(String string)
- SimpleCalcException(String string, Throwable cause)
Implement basic mathematical operations for SimpleCalc class with int numbers in range of [-10..+10] (including) to pass unit tests
Notes
- Input range is checked using assertions (so if they are disabled, inputs can be any int)
- Outputs are always checked and exception is thrown if it is outside allowed range
- Only SimpleCalcExceptions may be thrown. AssertionErrors have to be caught and wrapped into SimpleCalcExceptions