### Question:
ManagedResourceProvider implements ResourceProvider { protected File validateFolder( File folder ) { return folder != null && folder.exists() && folder.isDirectory() ? folder : null; }  void setBundleContext( BundleContext bundleContext ); void init(); @Override File getManagedResourceFolder(); @Override File provideFolder( Bundle bundle, String relativePath ); @Override File provideFolder( String bundleName, String relativePath ); @Override File provideFile( Bundle bundle, String relativePath ); @Override File provideFile( String bundleName, String relativePath ); static String MANAGED_RESOURCES_DIR; }### Answer:
@Test public void validateFolderTest() { assertNull( resourceProvider.validateFolder( null ) ); File folder = mock( File.class ); doReturn( false ).when( folder ).exists(); assertNull( resourceProvider.validateFolder( null ) ); doReturn( true ).when( folder ).exists(); doReturn( false ).when( folder ).isDirectory(); assertNull( resourceProvider.validateFolder( null ) ); doReturn( true ).when( folder ).isDirectory(); assertEquals( folder, resourceProvider.validateFolder( folder ) ); }