-
Notifications
You must be signed in to change notification settings - Fork 50
test: Reduce usage of singelton within our tests and implementations #1331
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
test: Reduce usage of singelton within our tests and implementations #1331
Conversation
65dab59
to
0ff7ece
Compare
20b50c7
to
be2a2f5
Compare
Our tests are great, but often we rely on our own Singelton for testing purposes. This can create concurrency issues or make testing really hard. By instantiating a own API object for each test we ensure that we are not messing with each other. Furthermore we should not use `.getInstance()` within our own implementation. Signed-off-by: Simon Schrottner <[email protected]>
be2a2f5
to
22824c8
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1331 +/- ##
============================================
+ Coverage 93.04% 93.23% +0.19%
- Complexity 466 467 +1
============================================
Files 43 43
Lines 1121 1123 +2
Branches 90 90
============================================
+ Hits 1043 1047 +4
+ Misses 49 48 -1
+ Partials 29 28 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I quite like this! The one concern I have would be people not using the singleton causing issues.
The good part is, the constructor is not public but protected, and always have been. Hence either people need to extend the API object, or have to be in the same package. This is already possible, so we are actually not changing anything regarding this behavior |
Signed-off-by: Simon Schrottner <[email protected]>
c324962
to
739204d
Compare
739204d
to
f53d459
Compare
Signed-off-by: Simon Schrottner <[email protected]>
f53d459
to
93e14f7
Compare
Signed-off-by: Simon Schrottner <[email protected]>
|
Our tests are great, but often we rely on our own Singleton for testing purposes. This can create concurrency issues or make testing really hard. By instantiating a own API object for each test we ensure that we are not messing with each other.
Furthermore we should not use
.getInstance()
within our own implementation, which is now ensured with an ArchUnit test