Github user rafaelweingartner commented on the pull request:

    https://github.com/apache/cloudstack/pull/1331#issuecomment-208318739
  
    @syed, you can change the method to be protected.
    IMO every single method that has some logic in it should be tested without 
any discrimination among private and non-private ones.
    
    To write a test for this method, you can use Mockito; you can use the spy 
method into the object that you want to test (NfsSecondaryStorageResource), 
then you can force an exception to be thrown when the "execute" method is 
called with “deleteCommand” object.
    To check if the exception was treated properly you can use Mockito to mock 
the s_logger object and check if the “debug” method was called after the 
exception is thrown
    
    This way, if someone changes the logic and let the exception be re-thrown, 
the test case will catch. Also, if someone silences the exception, the test 
case will catch.
    
    If you have doubts/problems when writing the test case, just call me.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to