Skip to content
This repository has been archived by the owner on Nov 6, 2022. It is now read-only.

enum singleton testing impossible #4

Closed
compscidr opened this issue Dec 16, 2020 · 1 comment
Closed

enum singleton testing impossible #4

compscidr opened this issue Dec 16, 2020 · 1 comment

Comments

@compscidr
Copy link
Collaborator

Currently the SessionManager uses static methods via an enum class / singleton model.

Mockito on its own can't mock the methods so testing things which uses the SessionManager is impossible. One workaround is to use PowerMockito, however, it requires Junit4, and everything now is setup to use Junit5 (Jupiter). PowerMockito does not work on Junit5, and tickets have been stalled since 2016:

It seems to be that the junit5 team won't add support for whats needed to do it, robo electric is having a similar problem:

So, I'm not confident it will be fixed in any short order, making the fastest solution be a refactor which no longer uses the enum singleton model.

This might be a good time to also introduce dependency injection properly since it will likely require the SessionManager or something to be included in any class which uses it.

@compscidr
Copy link
Collaborator Author

Resolved by #5

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

No branches or pull requests

1 participant