commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Work logged] (NUMBERS-100) Code in file FractionTest.java is unsatisfactory
Date Wed, 22 May 2019 10:44:00 GMT

     [ https://issues.apache.org/jira/browse/NUMBERS-100?focusedWorklogId=246665&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-246665
]

ASF GitHub Bot logged work on NUMBERS-100:
------------------------------------------

                Author: ASF GitHub Bot
            Created on: 22/May/19 10:43
            Start Date: 22/May/19 10:43
    Worklog Time Spent: 10m 
      Work Description: Schamschi commented on pull request #35: NUMBERS-100: Alter code style
in FractionTest.java, and some minor edits
URL: https://github.com/apache/commons-numbers/pull/35
 
 
   
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 246665)
    Time Spent: 20m  (was: 10m)

> Code in file FractionTest.java is unsatisfactory
> ------------------------------------------------
>
>                 Key: NUMBERS-100
>                 URL: https://issues.apache.org/jira/browse/NUMBERS-100
>             Project: Commons Numbers
>          Issue Type: Improvement
>          Components: fraction
>            Reporter: Heinrich Bohne
>            Priority: Trivial
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> The following characteristics of the file {{FractionTest.java}} can be improved:
> * The second-to-last try-catch-block in the method {{testAdd()}} is a duplicate of the
preceding try-catch-block and is therefore redundant.
> * In the method {{testPow()}}, the conditions {{assertFraction(9, 49, a.pow(2))}} and
{{assertFraction(49, 9, a.pow(-2))}} are tested twice each (once in the block after {{a}}'s
declaration, and a second time in the block after {{b}}'s declaration. This is probably a
typo.
> * The last two assertions in the method {{testGetReducedFraction()}} pass the parameters
to the method {{Assert.assertEquals(long, long)}} in the wrong order (the expected value should
go first).
> * Several methods in this class contain a number of tests that use shared local variables
but are completely independent of each other because these local variables get assigned new
values at the beginning of a test. The fact that the scope of these local variables encompasses
all those independent tests makes the code look more confusing than necessary.
> * Except for the method {{testGoldenRatio()}}, the throwing of an exception is tested
with a construct involving the swallowing of an exception, rather than an explicit syntax.
> * The helper method {{assertFraction(int, int, Fraction)}} is neglected throughout large
sections of the class in favor of {{Assert.assertEquals(long, long)}} pairs, increasing the
amount of code duplication.



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

Mime
View raw message