Header Ads

  • Breaking Now

    When assertions should be avoided?

    In following situations the assertions should be avoided:
    -When assertion becomes a performance issue.It means an assertion should not include too complex logic equalling implementation of a method.
    -Do not use assertions in argument checking of public methods.As argument checking is part of a method implementation and if these arguments are erroneous then it will throw runtime exception and assertion failure will not result in any error.

    Post Top Ad

    Post Bottom Ad