-
Notifications
You must be signed in to change notification settings - Fork 481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add mocks for InputStream so that Imgur tests do not fail offline #1240
Conversation
...gur/src/main/java/org/datatransferproject/datatransfer/imgur/photos/ImgurPhotosExporter.java
Show resolved
Hide resolved
...gur/src/main/java/org/datatransferproject/datatransfer/imgur/photos/ImgurPhotosExporter.java
Outdated
Show resolved
Hide resolved
// return new URL(imageUrl); | ||
// } | ||
|
||
public interface UrlFactory{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you need this, btw. I think you can just declare the type of your urlFactory
param to be Function<String, URL> urlFactory
in your constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed from interface to declaring the param type, thanks
...mgur/src/test/java/org/datatransferproject/transfer/imgur/photos/ImgurPhotoExporterTest.java
Outdated
Show resolved
Hide resolved
LGTM! |
URL u = null; | ||
try { | ||
u = spy(new URL(urlString)); | ||
} catch (MalformedURLException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nit; up to you if you feel like tackling this right now)
i see why the try/catch in the real code, but probably not necessary in the test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The build failed without the try/catch, even with the call being in the test
Fix for #1105