Skip to content
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

Merged
merged 9 commits into from May 8, 2023

Conversation

kateyeo
Copy link
Collaborator

@kateyeo kateyeo commented May 2, 2023

Fix for #1105

@kateyeo kateyeo requested review from jzacsh and seehamrun May 3, 2023 00:00
// return new URL(imageUrl);
// }

public interface UrlFactory{
Copy link
Collaborator

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.

Copy link
Collaborator Author

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

@jzacsh
Copy link
Collaborator

jzacsh commented May 5, 2023

LGTM!

@kateyeo kateyeo requested a review from jzacsh May 5, 2023 22:27
URL u = null;
try {
u = spy(new URL(urlString));
} catch (MalformedURLException e) {
Copy link
Collaborator

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?

Copy link
Collaborator Author

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

@kateyeo kateyeo merged commit 53a1834 into master May 8, 2023
5 checks passed
@kateyeo kateyeo deleted the imgurfix branch May 8, 2023 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants