garydgregory commented on a change in pull request #149: URL: https://github.com/apache/commons-vfs/pull/149#discussion_r535352512
########## File path: commons-vfs2/src/test/java/org/apache/commons/vfs2/impl/DefaultFileSystemManagerTest.java ########## @@ -47,4 +50,34 @@ public void test_close() throws FileSystemException { Assert.assertFalse(VFS.getManager().resolveFile(Paths.get("DoesNotExist.not").toUri()).exists()); } + @Test + public void testAddAndRemoveProvider() throws FileSystemException { + try (DefaultFileSystemManager fileSystemManager = new DefaultFileSystemManager()) { + fileSystemManager.setFilesCache(new NullFilesCache()); + fileSystemManager.setCacheStrategy(CacheStrategy.MANUAL); + + // this is to check when exactly `close` of the provider is called + Boolean[] closed = { Boolean.FALSE }; Review comment: Hi @boris-petrov Thank you for your update. This is a bit of an anti-pattern here, as in general you should use an `AtomicBoolean` instead of a 1-element array. BUT, since this is a test and you want to verify that a method was called, this is done using Mockito which we already depend on and you can simply use by following the pattern described here https://stackoverflow.com/questions/9841623/mockito-how-to-verify-method-was-called-on-an-object-created-within-a-method ---------------------------------------------------------------- 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: us...@infra.apache.org