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

Remove singleton dependency from request tracker unit tests. #340

Merged
merged 2 commits into from
Nov 13, 2018

Conversation

mikkokar
Copy link
Contributor

Also tidy up the code a bit.

public static final CurrentRequestTracker INSTANCE = new CurrentRequestTracker();

private CurrentRequestTracker() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of letting the CurrentRequestTracker be the default, I would rather set the appropriate visibility (hopefully package private will suffice) and annotate the method with @VisibleForTesting. Probably we should redesign something if need public visibility as this is supposed to be a singleton...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you mean @dvlato? If you refer to constructor visibility, package private is not enough because we need to create instances in various test cases outside of track package.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's quite unfortunate. I would still at least create a explicit constructor with the @VisibleForTesting annotation. Another option would be to have a private constructor and a static factory method that has the visible for testing annotation.

@mikkokar mikkokar merged commit aa825f8 into ExpediaGroup:master Nov 13, 2018
@mikkokar mikkokar deleted the request-tracker-test-cases branch November 13, 2018 13:50
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.

2 participants