File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -27,15 +27,17 @@ class MockDownloader extends Downloader {
2727 public MockDownloader (@ Nonnull String path ) throws IOException {
2828 this .path = path ;
2929 this .mocks = new HashMap <>();
30- File folder = new File (path );
31- for (File file : folder .listFiles ()) {
32- if (file .getName ().startsWith (RecordingDownloader .FILE_NAME_PREFIX )) {
33- final FileReader reader = new FileReader (file );
34- final TestRequestResponse response = new GsonBuilder ()
35- .create ()
36- .fromJson (reader , TestRequestResponse .class );
37- reader .close ();
38- mocks .put (response .getRequest (), response .getResponse ());
30+ final File [] files = new File (path ).listFiles ();
31+ if (files != null ) {
32+ for (File file : files ) {
33+ if (file .getName ().startsWith (RecordingDownloader .FILE_NAME_PREFIX )) {
34+ final FileReader reader = new FileReader (file );
35+ final TestRequestResponse response = new GsonBuilder ()
36+ .create ()
37+ .fromJson (reader , TestRequestResponse .class );
38+ reader .close ();
39+ mocks .put (response .getRequest (), response .getResponse ());
40+ }
3941 }
4042 }
4143 }
You can’t perform that action at this time.
0 commit comments