Hi Manuri, In my point of view The Exception is the super class of all subclass of exceptions inherited. In case you know strongly which type of exception could be thrown while execution it is better to use the exact instance of sub class of exception rather than catching generic exception while the execution
On Tue, Sep 8, 2015 at 11:24 AM, Nuwan Wimalasekara <nuw...@wso2.com> wrote: > Hi Manuri, > > Even if we throws the sub classes in test methods , no one will handle > those exception explicitly. It is handled by TestNg and TestsNg marked them > error when exception is thrown from a test method and we can see the actual > exception class in test reports. Throwing super class also make sure that > the test method will not be broken even exception classes is changed in the > method which are used in test methods. > > Please refer the mail thread "Best Practice in Throwing Exceptions in test > methods signature"@dev > > Thanks, > Nuwanw > > On Tue, Sep 8, 2015 at 11:05 AM, Manuri Amaya Perera <manu...@wso2.com> > wrote: > >> Hi, >> >> I got to know it is recommended to throw Exception in test methods >> instead of the specific sub class of it. But generally in methods the good >> practice is to throw the exception of the specific sub class. >> >> I'd like to know $subject. >> >> Thank you. >> >> -- >> >> *Manuri Amaya Perera* >> >> *Software Engineer* >> >> *WSO2 Inc.* >> >> *Blog: http://manuriamayaperera.blogspot.com >> <http://manuriamayaperera.blogspot.com>* >> > > > > -- > Nuwan Wimalasekara > Senior Software Engineer - Test Automation > WSO2, Inc.: http://wso2.com > lean. enterprise. middleware > > phone: +94 71 668 4620 > > > > > _______________________________________________ > Dev mailing list > Dev@wso2.org > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- *Thank You.* *Rajeenthini Satkunam* *Associate Software Engineer | WSO2* *E:rajeenth...@wso2.com <rajeenth...@wso2.com>* *M :+94770832823 *
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev