Github user rafaelweingartner commented on a diff in the pull request: https://github.com/apache/cloudstack/pull/1331#discussion_r59762357 --- Diff: services/secondary-storage/server/test/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResourceTest.java --- @@ -88,6 +93,19 @@ public void testMount() throws Exception { } } + @Test + public void testCleanupNfsStaging(){ + TemplateObjectTO templateMock = Mockito.mock(TemplateObjectTO.class); + Exception exception = new Exception(); + resource.logger = Mockito.mock(Logger.class); + + Mockito.doNothing().when(resource.logger).debug("Failed to clean up staging area:", exception); + Mockito.when(resource.execute(any(DeleteCommand.class))).thenThrow(exception); --- End diff -- I didn't use that other approach because I think it adds more complications. I find it easier to use the Mockito and then just checking if the method was used. It feels more natural.
--- 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. ---