Skip to content

Commit

Permalink
Merge pull request #93 from s4u/fix-sonar
Browse files Browse the repository at this point in the history
fix sonar issues
  • Loading branch information
slawekjaranowski authored Jul 13, 2021
2 parents 52e0d72 + 5640301 commit ddf805c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/simplify4u/slf4jmock/MDCMock.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected MDCMock() {
}

private static MDCAdapter initMockProxy() {
return (MDCAdapter) Proxy.newProxyInstance(MDCMock.class.getClassLoader(),
return (MDCAdapter) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(),
new Class<?>[]{MDCAdapter.class, ProxyMock.class},
new MockInvocationHandler("MDC", () -> mock(MDCAdapter.class, withSettings().stubOnly()))
);
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/simplify4u/slf4jmock/ProxyMock.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

package org.simplify4u.slf4jmock;

import org.slf4j.Logger;

/**
* Interface to describe proxy for created Logger.
* <p>
Expand All @@ -29,6 +27,9 @@ public interface ProxyMock {

Object getMock();

/**
* reset internal mocks state.
*/
void clearMock();

String getMockName();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/slf4j/impl/StaticLoggerBinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@

import org.simplify4u.slf4jmock.LoggerMock;

/**
* Implementation of Logger Binder.
*/
public class StaticLoggerBinder extends LoggerMock {

private static final StaticLoggerBinder SINGLETON = new StaticLoggerBinder();
Expand Down
3 changes: 3 additions & 0 deletions src/main/java/org/slf4j/impl/StaticMDCBinder.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
import org.simplify4u.slf4jmock.MDCMock;
import org.slf4j.spi.MDCAdapter;

/**
* Implementation for MDC Binder
*/
public class StaticMDCBinder extends MDCMock {

static final StaticMDCBinder SINGLETON = new StaticMDCBinder();
Expand Down

0 comments on commit ddf805c

Please sign in to comment.