SethiPandi opened a new pull request #50:
URL: https://github.com/apache/commons-beanutils/pull/50


   While working on another PR, I noticed some unit tests started locking up 
when I lost my internet connection temporarily.
   When looking into why, I learned something interesting about the 
`URL#equals` method.
   
   ```java
   /**
    * ...
    * Two URL objects are equal if they have the same protocol, reference
    * equivalent hosts, have the same port number on the host, and the same
    * file and fragment of the file.<p>
    *
    * Two hosts are considered equivalent if both host names can be resolved
    * into the same IP addresses; else if either host name can't be
    * resolved, the host names must be equal without regard to case; or both
    * host names equal to null.<p>
    *
    * Since hosts comparison requires name resolution, this operation is a
    * blocking operation. <p>
    * ...
    */
   ```
   
   In other words, the tests for the URLConverter connect to the internet and 
will stall the tests if it's unable to do so as it's a blocking operation.
   
   I'm not sure what the guidelines for the repository is, but I've always been 
pretty firm on, configuration/environment should not affect automated tests, so 
I think this should be changed to no longer block when there's no internet.
   
   I'm not sure if the fix is perfect from a QA standpoint, but it avoids this 
by comparing `String`s instead of `URL`s.
   
   ---
   
   While I was at it, I also updated the URLConverter to use JUnit 4.


----------------------------------------------------------------
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:
[email protected]


Reply via email to