-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
#2126 add SQLLoggerTest #2127
#2126 add SQLLoggerTest #2127
Conversation
|
||
public final class SQLLoggerTest { | ||
|
||
private String sql; |
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.
Fields should have a blank line each other
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.
Ok,I will fix this.
import static org.hamcrest.CoreMatchers.is; | ||
import static org.junit.Assert.assertThat; | ||
|
||
public final class SQLLoggerTest { |
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.
Should use mock, not test real logback
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.
Mockito can not support mock static method. Should I add powermock to the project dependency tree?
|
I can not find a way to mock a logger for SQLLogger. Mockito can create a mock for Logger,but I can not figure out how to replace real logger with the mock logger.So I close the pull now. |
@terrymanu PowerMock can do this work.
|
Import new mock dependency is unnecessary. |
You can use reflection to inject mocked logger |
Thanks,I will try. |
Fixes #2126 .
Changes proposed in this pull request: