This is an automated email from the ASF dual-hosted git repository.

jsedding pushed a commit to branch testing/extra-logging
in repository 
https://gitbox.apache.org/repos/asf/sling-org-apache-sling-resourceresolver.git


The following commit(s) were added to refs/heads/testing/extra-logging by this 
push:
     new cff76db  thread name
cff76db is described below

commit cff76db4b014a5b3bdeb3247d8fab4e2b44f7f3c
Author: Julian Sedding <jsedd...@apache.org>
AuthorDate: Fri Sep 29 13:01:19 2023 +0200

    thread name
---
 .../impl/FactoryRegistrationHandlerTest.java                 | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git 
a/src/test/java/org/apache/sling/resourceresolver/impl/FactoryRegistrationHandlerTest.java
 
b/src/test/java/org/apache/sling/resourceresolver/impl/FactoryRegistrationHandlerTest.java
index bf02d5f..d916123 100644
--- 
a/src/test/java/org/apache/sling/resourceresolver/impl/FactoryRegistrationHandlerTest.java
+++ 
b/src/test/java/org/apache/sling/resourceresolver/impl/FactoryRegistrationHandlerTest.java
@@ -30,8 +30,10 @@ import 
org.apache.sling.testing.mock.osgi.junit5.OsgiContextBuilder;
 import org.apache.sling.testing.mock.osgi.junit5.OsgiContextExtension;
 import org.hamcrest.Matcher;
 import org.jetbrains.annotations.NotNull;
+import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.RepeatedTest;
+import org.junit.jupiter.api.TestInfo;
 import org.junit.jupiter.api.extension.ExtendWith;
 import org.mockito.Mockito;
 import org.mockito.internal.stubbing.defaultanswers.ReturnsSmartNulls;
@@ -80,9 +82,12 @@ class FactoryRegistrationHandlerTest {
             .build();
 
     private ResourceResolverFactoryActivator activator;
+    private String originalThreadName;
 
     @BeforeEach
-    void setUp() {
+    void setUp(TestInfo testInfo) {
+        originalThreadName = Thread.currentThread().getName();
+        Thread.currentThread().setName(originalThreadName + "(" + 
testInfo.getDisplayName() + ")");
         final ResourceProviderTracker resourceProviderTracker = 
mock(ResourceProviderTracker.class);
         
doReturn(mock(ResourceProviderStorage.class)).when(resourceProviderTracker).getResourceProviderStorage();
 
@@ -99,6 +104,11 @@ class FactoryRegistrationHandlerTest {
         doCallRealMethod().when(activator).getRuntimeService();
     }
 
+    @AfterEach
+    void tearDown() {
+        Thread.currentThread().setName(originalThreadName);
+    }
+
     private static <T> T mock(Class<T> classToMock) {
         return Mockito.mock(classToMock, new ReturnsSmartNulls());
     }

Reply via email to