[ 
https://issues.apache.org/jira/browse/NUMBERS-99?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16843419#comment-16843419
 ] 

Gilles commented on NUMBERS-99:
-------------------------------

Thanks for the contribution.


 However, with new contributions, we try to improve readability; a.o. things, 
unit test methods should strive to focus on single checks. I.e. if several 
conditions must be checked for, say, the "add" method, multiple test methods 
should be defined: {{testAdd1()}}, {{testAdd2()}}, ...
 And those where an exception is expected to be thrown should be annotated:
{code:java}
@Test(expected=SomeException.class)
{code}
rather than having an explicit {{catch}} in the test method.

> Fraction.add(int) and Fraction.subtract(int) ignore risk of integer overflow
> ----------------------------------------------------------------------------
>
>                 Key: NUMBERS-99
>                 URL: https://issues.apache.org/jira/browse/NUMBERS-99
>             Project: Commons Numbers
>          Issue Type: Bug
>          Components: fraction
>            Reporter: Heinrich Bohne
>            Priority: Minor
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> The methods {{add(int)}} and {{subtract(int)}} in the class 
> {{org.apache.commons.numbers.fraction.Fraction}} do not take into account the 
> risk of an integer overflow. For example, (2​^31^ - 1)/2 + 1 = (2​^31^ + 
> 1)/2, so the numerator overflows an {{int}}, but when calculated with 
> {{Fraction.add(int)}}, the method still returns normally.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to