[logback-dev] svn commit: r1800 - in logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic: . pattern

noreply.ceki at qos.ch noreply.ceki at qos.ch
Mon Sep 8 20:55:30 CEST 2008


Author: ceki
Date: Mon Sep  8 20:55:30 2008
New Revision: 1800

Modified:
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java
   logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/pattern/MDCConverterTest.java

Log:
- ensuring that tests pass with IBM's JDK

Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/PatternLayoutTest.java	Mon Sep  8 20:55:30 2008
@@ -9,22 +9,19 @@
  */
 package ch.qos.logback.classic;
 
+import static ch.qos.logback.classic.TestConstants.ISO_REGEX;
+import static ch.qos.logback.classic.TestConstants.MAIN_REGEX;
+
 import java.util.ArrayList;
 import java.util.List;
 
 import junit.framework.Test;
 import junit.framework.TestSuite;
-
-import ch.qos.logback.classic.Logger;
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.LoggerContext;
-import ch.qos.logback.classic.PatternLayout;
 import ch.qos.logback.classic.pattern.ConverterTest;
 import ch.qos.logback.classic.spi.LoggingEvent;
 import ch.qos.logback.core.Context;
 import ch.qos.logback.core.pattern.PatternLayoutBase;
 import ch.qos.logback.core.pattern.parser.AbstractPatternLayoutBaseTest;
-import static  ch.qos.logback.classic.TestConstants.*;
 
 public class PatternLayoutTest extends AbstractPatternLayoutBaseTest {
 
@@ -81,13 +78,13 @@
 
   public void testCompositePattern() {
     PatternLayout pl = new PatternLayout();
-    pl.setPattern("%-56(%d [%t] %lo{20}) - %m%n");
+    pl.setPattern("%-56(%d %lo{20}) - %m%n");
     Context context = new LoggerContext();
     pl.setContext(context);
     pl.start();
     String val = pl.doLayout(getEventObject());
-    // 2008-03-18 21:55:54,250 [main] c.q.l.c.pattern.ConverterTest - Some message
-    String regex = ISO_REGEX+" "+MAIN_REGEX+" c.q.l.c.p.ConverterTest - Some message\\s*";
+    // 2008-03-18 21:55:54,250 c.q.l.c.pattern.ConverterTest          - Some message
+    String regex = ISO_REGEX+" c.q.l.c.p.ConverterTest          - Some message\\s*";
     assertTrue(val.matches(regex));
 
   }

Modified: logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/pattern/MDCConverterTest.java
==============================================================================
--- logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/pattern/MDCConverterTest.java	(original)
+++ logback/trunk/logback-classic/src/test/java/ch/qos/logback/classic/pattern/MDCConverterTest.java	Mon Sep  8 20:55:30 2008
@@ -7,24 +7,25 @@
 import ch.qos.logback.classic.Level;
 import ch.qos.logback.classic.LoggerContext;
 import ch.qos.logback.classic.spi.LoggingEvent;
+import ch.qos.logback.core.util.SystemInfo;
 
 public class MDCConverterTest extends TestCase {
-  
+
   LoggerContext lc;
   MDCConverter converter;
-  
+
   public void setUp() throws Exception {
     lc = new LoggerContext();
     converter = new MDCConverter();
     converter.start();
   }
-  
+
   public void tearDown() throws Exception {
     lc = null;
     converter.stop();
     converter = null;
   }
-  
+
   public void testConverWithOneEntry() {
     MDC.clear();
     MDC.put("testKey", "testValue");
@@ -39,12 +40,17 @@
     MDC.put("testKey2", "testValue2");
     LoggingEvent le = createLoggingEvent();
     String result = converter.convert(le);
-    assertEquals("testKey=testValue, testKey2=testValue2", result);
+    if (SystemInfo.getJavaVendor().contains("IBM")) {
+      assertEquals("testKey2=testValue2, testKey=testValue", result);
+    } else {
+      assertEquals("testKey=testValue, testKey2=testValue2", result);
+    }
   }
-  
+
   private LoggingEvent createLoggingEvent() {
-    LoggingEvent le = new LoggingEvent(this.getClass().getName(), lc.getLogger(LoggerContext.ROOT_NAME),
-        Level.DEBUG, "test message", null, null);
+    LoggingEvent le = new LoggingEvent(this.getClass().getName(), lc
+        .getLogger(LoggerContext.ROOT_NAME), Level.DEBUG, "test message", null,
+        null);
     return le;
   }
 }


More information about the logback-dev mailing list