logging-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ggreg...@apache.org
Subject svn commit: r1480720 - /logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketServerTest.java
Date Thu, 09 May 2013 16:41:58 GMT
Author: ggregory
Date: Thu May  9 16:41:57 2013
New Revision: 1480720

URL: http://svn.apache.org/r1480720
Log:
Refactor and reuse message fixtures into constants.

Modified:
    logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketServerTest.java

Modified: logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketServerTest.java
URL: http://svn.apache.org/viewvc/logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketServerTest.java?rev=1480720&r1=1480719&r2=1480720&view=diff
==============================================================================
--- logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketServerTest.java
(original)
+++ logging/log4j/log4j2/trunk/core/src/test/java/org/apache/logging/log4j/core/net/SocketServerTest.java
Thu May  9 16:41:57 2013
@@ -44,6 +44,8 @@ import static org.junit.Assert.assertTru
  */
 public class SocketServerTest {
 
+    private static final String MESSAGE_1 = "This is a test message";
+    private static final String MESSAGE_2 = "This is test message 2";
     private static final String PORT = "8199";
     private static final int PORTNUM = Integer.parseInt(PORT);
 
@@ -102,15 +104,15 @@ public class SocketServerTest {
         root.addAppender(listApp);
         root.setAdditive(false);
         root.setLevel(Level.DEBUG);
-        root.debug("This is a test message");
-        root.debug("This is test message 2");
+        root.debug(MESSAGE_1);
+        root.debug(MESSAGE_2);
         Thread.sleep(100);
         final List<LogEvent> events = listApp.getEvents();
         assertNotNull("No event retrieved", events);
         assertTrue("No events retrieved", events.size() > 0);
-        assertTrue("Incorrect event", events.get(0).getMessage().getFormattedMessage().equals("This
is a test message"));
+        assertTrue("Incorrect event", events.get(0).getMessage().getFormattedMessage().equals(MESSAGE_1));
         assertTrue("Incorrect number of events received", events.size() == 2);
-        assertTrue("Incorrect event", events.get(1).getMessage().getFormattedMessage().equals("This
is test message 2"));
+        assertTrue("Incorrect event", events.get(1).getMessage().getFormattedMessage().equals(MESSAGE_2));
     }
 
     private class ThreadFilter extends AbstractFilter {



Mime
View raw message