@Test public void testEnsureDirectoryWhenDirectoryExists() { Path path = mock(Path.class); when(provisioningPath.resolve(DIRECTORY_NAME)).thenReturn(path); when(ioService.exists(path)).thenReturn(true); Path result = registryHelper.ensureDirectory(DIRECTORY_NAME); verify(provisioningPath, times(1)).resolve(DIRECTORY_NAME); verify(ioService, never()).createDirectory(path); assertEquals(path, result); }
public Path ensureDirectory(final String directory) { Path directoryPath = provisioningRootPath.resolve(directory); if (!ioService.exists(directoryPath)) { directoryPath = ioService.createDirectory(directoryPath); } return directoryPath; }
VFSRegistryHelper { public Path ensureDirectory(final String directory) { Path directoryPath = provisioningRootPath.resolve(directory); if (!ioService.exists(directoryPath)) { directoryPath = ioService.createDirectory(directoryPath); } return directoryPath; } }
VFSRegistryHelper { public Path ensureDirectory(final String directory) { Path directoryPath = provisioningRootPath.resolve(directory); if (!ioService.exists(directoryPath)) { directoryPath = ioService.createDirectory(directoryPath); } return directoryPath; } VFSRegistryHelper(); @Inject  VFSRegistryHelper(final VFSMarshallerRegistry marshallerRegistry,
                             final @Named("ioStrategy") IOService ioService,
                             final @Named("systemFS") FileSystem fileSystem); }
VFSRegistryHelper { public Path ensureDirectory(final String directory) { Path directoryPath = provisioningRootPath.resolve(directory); if (!ioService.exists(directoryPath)) { directoryPath = ioService.createDirectory(directoryPath); } return directoryPath; } VFSRegistryHelper(); @Inject  VFSRegistryHelper(final VFSMarshallerRegistry marshallerRegistry,
                             final @Named("ioStrategy") IOService ioService,
                             final @Named("systemFS") FileSystem fileSystem); Path ensureDirectory(final String directory); String md5Hex(String content); void storeEntry(final Path path,
                           final Object value); Object readEntry(final Path path); List<Object> readEntries(final Path rootPath,
                                    final DirectoryStream.Filter<Path> filter); void writeBatch(final Path path,
                           final String content); void deleteBatch(final Path path); }
VFSRegistryHelper { public Path ensureDirectory(final String directory) { Path directoryPath = provisioningRootPath.resolve(directory); if (!ioService.exists(directoryPath)) { directoryPath = ioService.createDirectory(directoryPath); } return directoryPath; } VFSRegistryHelper(); @Inject  VFSRegistryHelper(final VFSMarshallerRegistry marshallerRegistry,
                             final @Named("ioStrategy") IOService ioService,
                             final @Named("systemFS") FileSystem fileSystem); Path ensureDirectory(final String directory); String md5Hex(String content); void storeEntry(final Path path,
                           final Object value); Object readEntry(final Path path); List<Object> readEntries(final Path rootPath,
                                    final DirectoryStream.Filter<Path> filter); void writeBatch(final Path path,
                           final String content); void deleteBatch(final Path path);  }