mirror of
https://github.com/TeamNewPipe/NewPipeExtractor.git
synced 2025-04-29 00:10:35 +05:30
Check for non-existent folder in MockDownloader
This commit is contained in:
parent
a0288b8fd6
commit
eecfe09f2c
@ -27,15 +27,17 @@ class MockDownloader extends Downloader {
|
|||||||
public MockDownloader(@Nonnull String path) throws IOException {
|
public MockDownloader(@Nonnull String path) throws IOException {
|
||||||
this.path = path;
|
this.path = path;
|
||||||
this.mocks = new HashMap<>();
|
this.mocks = new HashMap<>();
|
||||||
File folder = new File(path);
|
final File[] files = new File(path).listFiles();
|
||||||
for (File file : folder.listFiles()) {
|
if (files != null) {
|
||||||
if (file.getName().startsWith(RecordingDownloader.FILE_NAME_PREFIX)) {
|
for (File file : files) {
|
||||||
final FileReader reader = new FileReader(file);
|
if (file.getName().startsWith(RecordingDownloader.FILE_NAME_PREFIX)) {
|
||||||
final TestRequestResponse response = new GsonBuilder()
|
final FileReader reader = new FileReader(file);
|
||||||
.create()
|
final TestRequestResponse response = new GsonBuilder()
|
||||||
.fromJson(reader, TestRequestResponse.class);
|
.create()
|
||||||
reader.close();
|
.fromJson(reader, TestRequestResponse.class);
|
||||||
mocks.put(response.getRequest(), response.getResponse());
|
reader.close();
|
||||||
|
mocks.put(response.getRequest(), response.getResponse());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user