-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add FileLoggingTree Unit Tests #4802
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4802 +/- ##
============================================
+ Coverage 42.28% 42.66% +0.38%
- Complexity 1895 1907 +12
============================================
Files 364 364
Lines 15782 15782
Branches 1367 1367
============================================
+ Hits 6673 6733 +60
+ Misses 8618 8556 -62
- Partials 491 493 +2
Continue to review full report at Codecov.
|
} | ||
|
||
@Test | ||
fun testSetLogLevel() { |
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.
How the class stores the log level internally and what it does with it are 2 different things; I dont care too much that calling a setter stores a value, what I do care is that calls to the logger are filtered by that log level afterward. I think this test would be more informative if the verifications demonstrate that changing the log level means the internal logger is called (or not) depending on the value.
private lateinit var logger: Logger | ||
|
||
@Before | ||
fun setUp() { |
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 believe that all of the complex reflection-based method invocations would go away if you simply planted a Timber tree as part of the setup here, and used the public API through Timber.
) | ||
method.isAccessible = true | ||
method.invoke(fileLoggingTree, 0, "test", "test", Throwable()) | ||
} |
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.
missing a verification step here?
} | ||
|
||
@Test | ||
fun testIsLoggableCaseTrue() { |
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.
See my thoughts on testSetLogLevel
above
|
||
@Test | ||
fun testIsLoggableCaseFalse() { | ||
Whitebox.setInternalState(fileLoggingTree, "logLevel", Log.ASSERT) |
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.
See my thoughts on testSetLogLevel
above
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.
Could anyone address psh's comments? Thanks! :-)
Description
Add FileLoggingTree Unit Tests