fluo-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [fluo-examples] kpm1985 commented on issue #8: Initial PageLoader Test ClassInitial test for the PageLoader class that covers null and empty checks
Date Fri, 15 Mar 2019 22:16:06 GMT
kpm1985 commented on issue #8: Initial PageLoader Test ClassInitial test for the PageLoader
class that covers null and empty checks
URL: https://github.com/apache/fluo-examples/pull/8#issuecomment-473458259
 
 
   Just to document a few things and why this class/test even exists, I was reading through
the code and I noticed it had an empty check but not a null check. Then instead of just saying
that, I thought it would be good to write a test that exposes that problem. 
   
   I personally wanted to get more used to (experience) writing JUnit tests so I did a pretty
quick hack job to be a work in progress.  I'm also working being a lot more active than I
have been and it seemed like a fine idea to write some tests and increase the test coverage.

   
   As for the PageLoader class, I noticed load(Tx, Ctx) doesnt check for null args.  The deletePage(URL
url) requires url not be null but doesn't care if its a url representing "", ie empty or blank.
The updatePage(Page page) method requires the url is not "" or blank/empty but doesn't care
if it gets a null page (leading to NPE).
   
   So I was like sweet, maybe this is a decent class for me to write a test for. I did one
refactoring based on the first feedback, thank you for the feedback! Casting null is something
I'm not even sure I've seen before, that was really neat.
   
   There is still some to be done with the test as the load(tx,ctx) method uses deletePage(URL
url) and I am currently passing an empty page to it which fails the deletePage(URL) method
but can just produce a real non malformed url like maybe new URL("http://fluo.apache.org")
 
   

----------------------------------------------------------------
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


With regards,
Apache Git Services

Mime
View raw message