Skip to content

Commit 0d4f2eb

Browse files
Fix test in Maven run
There is pre-existing state in the MDC from other test-cases. This state is reset at the start of each test-case. Signed-off-by: Karsten Schnitter <[email protected]>
1 parent 522e882 commit 0d4f2eb

File tree

1 file changed

+8
-2
lines changed
  • cf-java-logging-support-core/src/test/java/com/sap/hcp/cf/logging/common/request

1 file changed

+8
-2
lines changed

cf-java-logging-support-core/src/test/java/com/sap/hcp/cf/logging/common/request/HttpHeadersTest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,21 @@
77
import static org.hamcrest.Matchers.is;
88
import static org.hamcrest.Matchers.nullValue;
99

10-
import org.hamcrest.MatcherAssert;
11-
import org.junit.Assert;
10+
import org.junit.Before;
1211
import org.junit.Test;
1312

1413
import com.sap.hcp.cf.logging.common.Defaults;
1514
import com.sap.hcp.cf.logging.common.Fields;
15+
import com.sap.hcp.cf.logging.common.LogContext;
1616

1717
public class HttpHeadersTest {
1818

19+
@Before
20+
public void resetLogContext() {
21+
LogContext.resetContextFields();
22+
HttpHeaders.propagated().stream().map(HttpHeader::getField).forEach(LogContext::remove);
23+
}
24+
1925
@Test
2026
public void hasCorrectNumberOfTypes() throws Exception {
2127
assertThat(HttpHeaders.values().length, is(equalTo(7)));

0 commit comments

Comments
 (0)