Skip to content

Break up me.psanders.ShortRouteFinder into testable components #10

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

Open
3 of 4 tasks
hxtk opened this issue Dec 1, 2017 · 3 comments
Open
3 of 4 tasks

Break up me.psanders.ShortRouteFinder into testable components #10

hxtk opened this issue Dec 1, 2017 · 3 comments
Labels

Comments

@hxtk
Copy link
Owner

hxtk commented Dec 1, 2017

  • Factory for matrix should take flags, a list of places, and a DistanceMatrixApiRequest object, modify that object based on the flags, and return a MatrixGraph<String, Long>

    • Mock DistanceMatrixApiRequest that fails to connect to the internet, i.e., throws ConnectException
    • Pass in a bad GeoApiContext, e.g., null, no API key, etc.
    • Mock that fails because the API key has exceeded its quota
    • Mock that works as expected
@hxtk hxtk added the test label Dec 1, 2017
@hxtk
Copy link
Owner Author

hxtk commented Dec 1, 2017

Mock DistanceMatrixApiRequest that "works", i.e., produces a static matrix of the same size as the input list of places.

This matrix should be random, but it should not change across calls or even executions.

@hxtk
Copy link
Owner Author

hxtk commented Dec 1, 2017

Note: we'll have to mock System and inject it as a dependency, or else the calls to System.exit in our error cases will cause problems.

@hxtk
Copy link
Owner Author

hxtk commented Dec 1, 2017

It might be better to simply remove the calls to System.exit: Print the error messages, then return null values all the way back up the chain of command and let main handle program termination.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant