stillalex commented on code in PR #1443:
URL: https://github.com/apache/solr/pull/1443#discussion_r1129747278


##########
solr/core/src/test/org/apache/solr/handler/TestHttpRequestId.java:
##########
@@ -45,79 +44,70 @@ public static void beforeTest() throws Exception {
   }
 
   @Test
-  public void mdcContextTest() throws Exception {
+  public void mdcContextTest() {
     String collection = "/collection1";
-    BlockingQueue<Runnable> workQueue = new SynchronousQueue<Runnable>(false);
+    BlockingQueue<Runnable> workQueue = new SynchronousQueue<>(false);
     setupClientAndRun(collection, workQueue);
   }
 
   @Test
-  public void mdcContextFailureTest() throws Exception {
+  public void mdcContextFailureTest() {
     String collection = "/doesnotexist";
-    BlockingQueue<Runnable> workQueue = new SynchronousQueue<Runnable>(false);
+    BlockingQueue<Runnable> workQueue = new SynchronousQueue<>(false);
     setupClientAndRun(collection, workQueue);
   }
 
   @Test
-  public void mdcContextTest2() throws Exception {
+  public void mdcContextTest2() {
     String collection = "/collection1";
-    BlockingQueue<Runnable> workQueue = new ArrayBlockingQueue<Runnable>(10, 
false);
+    BlockingQueue<Runnable> workQueue = new ArrayBlockingQueue<>(10, false);
     setupClientAndRun(collection, workQueue);
   }
 
   @Test
-  public void mdcContextFailureTest2() throws Exception {
+  public void mdcContextFailureTest2() {
     String collection = "/doesnotexist";
-    BlockingQueue<Runnable> workQueue = new ArrayBlockingQueue<Runnable>(10, 
false);
+    BlockingQueue<Runnable> workQueue = new ArrayBlockingQueue<>(10, false);
     setupClientAndRun(collection, workQueue);
   }
 
+  @SuppressForbidden(reason = "We need to use log4J2 classes directly to test 
MDC impacts")
   private void setupClientAndRun(String collection, BlockingQueue<Runnable> 
workQueue) {
-    String key = "mdcContextTestKey" + System.nanoTime();
-    String value = "TestHttpRequestId" + System.nanoTime();
+    final String key = "mdcContextTestKey" + System.nanoTime();
+    final String value = "TestHttpRequestId" + System.nanoTime();
 
     AsyncListener<NamedList<Object>> listener =
         new AsyncListener<>() {
-
           @Override
           public void onSuccess(NamedList<Object> t) {
-            assertTrue(value, value.equals(MDC.get(key)));
+            assertEquals(value, MDC.get(key));

Review Comment:
   this is a good catch, much better to have the values included in the 
assertion message.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to