@Test public void testCreateExists() throws Exception { folder.newFile("createexists.edb"); assertThatThrownBy(() -> provider.create("createexists")) .isInstanceOf(StorageExistsException.class) .hasMessageContaining("createexists"); }
@Override public Storage create(String name) throws StorageExistsException { Path path = getStorageFile(name); if (Files.exists(path)) { throw new StorageExistsException("Storage file already exists: " + path.toAbsolutePath()); } return new FileStorage(path); }
FileStorageProvider implements StorageProvider { @Override public Storage create(String name) throws StorageExistsException { Path path = getStorageFile(name); if (Files.exists(path)) { throw new StorageExistsException("Storage file already exists: " + path.toAbsolutePath()); } return new FileStorage(path); } }
FileStorageProvider implements StorageProvider { @Override public Storage create(String name) throws StorageExistsException { Path path = getStorageFile(name); if (Files.exists(path)) { throw new StorageExistsException("Storage file already exists: " + path.toAbsolutePath()); } return new FileStorage(path); } FileStorageProvider(Path storageDirectory); }
FileStorageProvider implements StorageProvider { @Override public Storage create(String name) throws StorageExistsException { Path path = getStorageFile(name); if (Files.exists(path)) { throw new StorageExistsException("Storage file already exists: " + path.toAbsolutePath()); } return new FileStorage(path); } FileStorageProvider(Path storageDirectory); @Override Storage create(String name); @Override Storage read(String name); @Override boolean exists(String name); }
FileStorageProvider implements StorageProvider { @Override public Storage create(String name) throws StorageExistsException { Path path = getStorageFile(name); if (Files.exists(path)) { throw new StorageExistsException("Storage file already exists: " + path.toAbsolutePath()); } return new FileStorage(path); } FileStorageProvider(Path storageDirectory); @Override Storage create(String name); @Override Storage read(String name); @Override boolean exists(String name);  }