Note, that this recipe is not updated long time and could be outdated!
Got it.

8. Exceptions and Assertions

  1. Review presentation Exceptions and assertions

    Practical exercise

  2. Investigate jtm.activity08 package
  3. Create class SimpleCalcException as a subclass of Exception
  4. Implement following constructors for this class:
    1. SimpleCalcException(String string)
    2. SimpleCalcException(String string, Throwable cause)
  5. Implement basic mathematical operations for SimpleCalc class with int numbers in range of [-10..+10] (including) to pass unit tests

    error Notes

    1. Input range is checked using assertions (so if they are disabled, inputs can be any int)
    2. Outputs are always checked and exception is thrown if it is outside allowed range
    3. Only SimpleCalcExceptions may be thrown. AssertionErrors have to be caught and wrapped into SimpleCalcExceptions

Additional information


  

Created by Valdis Vītoliņš on 2017-01-03 08:07
Last modified by Valdis Vītoliņš on 2021-05-06 17:02
 
Xwiki Powered
Creative Commons Attribution 3.0 Unported License