@Test public void testReadNotExists() { assertThatThrownBy(() -> provider.read("readnotexists")) .isInstanceOf(IllegalStateException.class) .hasMessageContaining("readnotexists"); }
@Override public Storage read(String name) { Path path = getStorageFile(name); if (Files.notExists(path)) { throw new IllegalStateException("Storage file not found:" + path.toAbsolutePath()); } return new FileStorage(path); }
FileStorageProvider implements StorageProvider { @Override public Storage read(String name) { Path path = getStorageFile(name); if (Files.notExists(path)) { throw new IllegalStateException("Storage file not found:" + path.toAbsolutePath()); } return new FileStorage(path); } }
FileStorageProvider implements StorageProvider { @Override public Storage read(String name) { Path path = getStorageFile(name); if (Files.notExists(path)) { throw new IllegalStateException("Storage file not found:" + path.toAbsolutePath()); } return new FileStorage(path); } FileStorageProvider(Path storageDirectory); }
FileStorageProvider implements StorageProvider { @Override public Storage read(String name) { Path path = getStorageFile(name); if (Files.notExists(path)) { throw new IllegalStateException("Storage file not found:" + 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 read(String name) { Path path = getStorageFile(name); if (Files.notExists(path)) { throw new IllegalStateException("Storage file not found:" + path.toAbsolutePath()); } return new FileStorage(path); } FileStorageProvider(Path storageDirectory); @Override Storage create(String name); @Override Storage read(String name); @Override boolean exists(String name);  }