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

Fixed tests for expected Map key order #47

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

kfreytag
Copy link

The existing test suite works by comparing static Strings to dynamically-generated JSON.

For this to work, the tests assume that keys entered added to a Map will be returned in the same ordered they were added. The problem is that the tests use a HashMap to store key/value pairs, and HashMap does not guarantee key order.

For these tests to pass, you need to use a Map instance that guarantees the order of keys. To that end, I've changed instances of HashMap usage to LinkedHashMap.

Now, the tests reliably pass.

@kfreytag
Copy link
Author

Added a second commit -- This commit does the following:

1/ Fixes the javadoc annotations so they pass when packaging under a modern JVM. Lots of // TODOs left in-place to document @param, @throws

2/ Changed the approach to getType throughout so that type is instantiated statically at the class level.

3/ Changed the Stat class to make getApiCall abstract and implemented it in both ListStat and BlastStat. Previously, Stat implemented getApiCall and always returned ApiAction.blast. That meant that every attempt to get stats about a List resulted in a call to https://api.sailthru.com/blast instead of https://api.sailthru.com/list.

@eweiser
Copy link

eweiser commented Nov 2, 2015

Hi there, thanks for submitting these fixes. We'll take a look and merge them in this week if all looks good.

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