You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by Maruan Sahyoun <sa...@fileaffairs.de> on 2015/02/17 23:03:19 UTC

Unit Tests and Exception

Hi,

most individual tests within unit tests have throws Exception - shouldn't we change it to the exception types we are typically throwing - mostly IOException and not have the raw Exception?

BR
Maruan

Re: Unit Tests and Exception

Posted by Maruan Sahyoun <sa...@fileaffairs.de>.
OK - I think, as we touch unit tests we shall fix that.

Other than that there are some raw exceptions being used in the main code too best viewed via Sonar.

BR
Maruan

Am 19.02.2015 um 00:18 schrieb John Hewson <jo...@jahewson.com>:

> As there's no code which ever calls those methods, other than the test runner, there's not any practical advantage to throwing more specific exceptions.
> 
> Still, throwing Exception isn't great style, so I'd be happy to see it changed.
> 
> -- John
> 
>> On 17 Feb 2015, at 14:03, Maruan Sahyoun <sa...@fileaffairs.de> wrote:
>> 
>> Hi,
>> 
>> most individual tests within unit tests have throws Exception - shouldn't we change it to the exception types we are typically throwing - mostly IOException and not have the raw Exception?
>> 
>> BR
>> Maruan
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
> For additional commands, e-mail: dev-help@pdfbox.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org


Re: Unit Tests and Exception

Posted by John Hewson <jo...@jahewson.com>.
As there's no code which ever calls those methods, other than the test runner, there's not any practical advantage to throwing more specific exceptions.

Still, throwing Exception isn't great style, so I'd be happy to see it changed.

-- John

> On 17 Feb 2015, at 14:03, Maruan Sahyoun <sa...@fileaffairs.de> wrote:
> 
> Hi,
> 
> most individual tests within unit tests have throws Exception - shouldn't we change it to the exception types we are typically throwing - mostly IOException and not have the raw Exception?
> 
> BR
> Maruan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org