Skip to content

Commit ddf805c

Browse files
Merge pull request #93 from s4u/fix-sonar
fix sonar issues
2 parents 52e0d72 + 5640301 commit ddf805c

File tree

4 files changed

+10
-3
lines changed

4 files changed

+10
-3
lines changed

src/main/java/org/simplify4u/slf4jmock/MDCMock.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ protected MDCMock() {
3333
}
3434

3535
private static MDCAdapter initMockProxy() {
36-
return (MDCAdapter) Proxy.newProxyInstance(MDCMock.class.getClassLoader(),
36+
return (MDCAdapter) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
3737
new Class<?>[]{MDCAdapter.class, ProxyMock.class},
3838
new MockInvocationHandler("MDC", () -> mock(MDCAdapter.class, withSettings().stubOnly()))
3939
);

src/main/java/org/simplify4u/slf4jmock/ProxyMock.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616

1717
package org.simplify4u.slf4jmock;
1818

19-
import org.slf4j.Logger;
20-
2119
/**
2220
* Interface to describe proxy for created Logger.
2321
* <p>
@@ -29,6 +27,9 @@ public interface ProxyMock {
2927

3028
Object getMock();
3129

30+
/**
31+
* reset internal mocks state.
32+
*/
3233
void clearMock();
3334

3435
String getMockName();

src/main/java/org/slf4j/impl/StaticLoggerBinder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717

1818
import org.simplify4u.slf4jmock.LoggerMock;
1919

20+
/**
21+
* Implementation of Logger Binder.
22+
*/
2023
public class StaticLoggerBinder extends LoggerMock {
2124

2225
private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();

src/main/java/org/slf4j/impl/StaticMDCBinder.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
import org.simplify4u.slf4jmock.MDCMock;
1919
import org.slf4j.spi.MDCAdapter;
2020

21+
/**
22+
* Implementation for MDC Binder
23+
*/
2124
public class StaticMDCBinder extends MDCMock {
2225

2326
static final StaticMDCBinder SINGLETON = new StaticMDCBinder();

0 commit comments

Comments
 (0)