You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by ca...@apache.org on 2006/01/11 23:20:05 UTC

svn commit: r368149 [3/4] - in /logging/sandbox/log4j/formatter: ./ src/ src/changes/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/log4j/ src/main/java/org/apache/log4j/formatter/ src/test/ src/test/jav...

Added: logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogFTest.java
URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogFTest.java?rev=368149&view=auto
==============================================================================
--- logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogFTest.java (added)
+++ logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogFTest.java Wed Jan 11 14:19:48 2006
@@ -0,0 +1,919 @@
+/*
+ * Copyright 1999,2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.formatter;
+
+import junit.framework.TestCase;
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+import org.apache.log4j.LogManager;
+
+/**
+ * Unit test for LogF.
+ */
+public class LogFTest extends TestCase {
+	/**
+	 * Logger.
+	 */
+	private final Logger logger = Logger
+			.getLogger("org.apache.log4j.formatter.LogFTest");
+
+	/**
+	 * Create the test case
+	 *
+	 * @param testName name of the test case
+	 */
+	public LogFTest(String testName) {
+		super(testName);
+	}
+
+	/**
+	 * Post test clean up.
+	 */
+	public void tearDown() {
+		LogManager.resetConfiguration();
+	}
+
+	/**
+	 * Test LogF.debug with null pattern.
+	 */
+	public void testDebugNullPattern() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		LogF.debug(logger, null);
+		assertNull(capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.debug with no-field pattern.
+	 */
+	public void testDebugNoArg() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		LogF.debug(logger, "Hello, World");
+		assertEquals("Hello, World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.debug with malformed pattern.
+	 */
+	public void testDebugBadPattern() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		LogF.debug(logger, "Hello, %.");
+		assertEquals("Hello, %.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.debug with missing argument.
+	 */
+	public void testDebugMissingArg() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		LogF.debug(logger, "Hello, %sWorld");
+		assertEquals("Hello, %sWorld", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.debug with single field pattern with string argument.
+	 */
+	public void testDebugString() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		LogF.debug(logger, "Hello, %s", "World");
+		assertEquals("Hello, World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.debug with single field pattern with null argument.
+	 */
+	public void testDebugNull() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		LogF.debug(logger, "Hello, %s", (Object) null);
+		assertEquals("Hello, null", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.debug with single field pattern with int argument.
+	 */
+	public void testDebugInt() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		int val = 42;
+		LogF.debug(logger, "Iteration %d", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.debug with single field pattern with byte argument.
+	 */
+	public void testDebugByte() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		byte val = 42;
+		LogF.debug(logger, "Iteration %d", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.debug with single field pattern with short argument.
+	 */
+	public void testDebugShort() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		short val = 42;
+		LogF.debug(logger, "Iteration %d", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.debug with single field pattern with long argument.
+	 */
+	public void testDebugLong() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		long val = 42;
+		LogF.debug(logger, "Iteration %d", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.debug with single field pattern with char argument.
+	 */
+	public void testDebugChar() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		char val = 'C';
+		LogF.debug(logger, "Iteration %c", val);
+		assertEquals("Iteration C", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.debug with single field pattern with boolean argument.
+	 */
+	public void testDebugBoolean() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		boolean val = true;
+		LogF.debug(logger, "Iteration %b", val);
+		assertEquals("Iteration true", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.debug with single field pattern with float argument.
+	 */
+	public void testDebugFloat() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		float val = 3.14f;
+		LogF.debug(logger, "Iteration %.2f", val);
+		assertEquals("Iteration " + String.valueOf(val), capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.debug with single field pattern with double argument.
+	 */
+	public void testDebugDouble() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		double val = 3.14;
+		LogF.debug(logger, "Iteration %.2f", val);
+		assertEquals("Iteration " + String.valueOf(val), capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.debug with two arguments.
+	 */
+	public void testDebugTwoArg() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		LogF.debug(logger, "%2$s, %1$s.", "World", "Hello");
+		assertEquals("Hello, World.", capture.getMessage());
+
+	}
+
+	/**
+	 * Test LogF.debug with three arguments.
+	 */
+	public void testDebugThreeArg() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		LogF.debug(logger, "%2$s%3$s %1$s.", "World", "Hello", ",");
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.debug with Object[] argument.
+	 */
+	public void testDebugArrayArg() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		Object[] args = new Object[] { "World", "Hello", ",", "." };
+		LogF.debug(logger, "%2$s%3$s %1$s%4$s", args);
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.debug with null Object[] argument.
+	 */
+	public void testDebugNullArrayArg() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		Object[] args = null;
+		LogF.debug(logger, "%2$s%3$s %1$s%4$s", args);
+		assertEquals("nullnull nullnull", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.debug with vararg list.
+	 */
+	public void testDebugVararg() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		LogF.debug(logger, "%2$s%3$s %1$s%4$s", "World", "Hello", ",", ".");
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.info with null pattern.
+	 */
+	public void testInfoNullPattern() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		LogF.info(logger, null);
+		assertNull(capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.info with no-field pattern.
+	 */
+	public void testInfoNoArg() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		LogF.info(logger, "Hello, World");
+		assertEquals("Hello, World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.info with malformed pattern.
+	 */
+	public void testInfoBadPattern() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		LogF.info(logger, "Hello, %.");
+		assertEquals("Hello, %.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.info with missing argument.
+	 */
+	public void testInfoMissingArg() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		LogF.info(logger, "Hello, %sWorld");
+		assertEquals("Hello, %sWorld", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.info with single field pattern with string argument.
+	 */
+	public void testInfoString() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		LogF.info(logger, "Hello, %s", "World");
+		assertEquals("Hello, World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.info with single field pattern with null argument.
+	 */
+	public void testInfoNull() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		LogF.info(logger, "Hello, %s", (Object) null);
+		assertEquals("Hello, null", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.info with single field pattern with int argument.
+	 */
+	public void testInfoInt() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		int val = 42;
+		LogF.info(logger, "Iteration %d", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.info with single field pattern with byte argument.
+	 */
+	public void testInfoByte() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		byte val = 42;
+		LogF.info(logger, "Iteration %d", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.info with single field pattern with short argument.
+	 */
+	public void testInfoShort() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		short val = 42;
+		LogF.info(logger, "Iteration %d", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.info with single field pattern with long argument.
+	 */
+	public void testInfoLong() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		long val = 42;
+		LogF.info(logger, "Iteration %d", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.info with single field pattern with char argument.
+	 */
+	public void testInfoChar() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		char val = 'C';
+		LogF.info(logger, "Iteration %c", val);
+		assertEquals("Iteration C", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.info with single field pattern with boolean argument.
+	 */
+	public void testInfoBoolean() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		boolean val = true;
+		LogF.info(logger, "Iteration %b", val);
+		assertEquals("Iteration true", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.info with single field pattern with float argument.
+	 */
+	public void testInfoFloat() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		float val = 3.14f;
+		LogF.info(logger, "Iteration %.2f", val);
+		assertEquals("Iteration " + String.valueOf(val), capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.info with single field pattern with double argument.
+	 */
+	public void testInfoDouble() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		double val = 3.14;
+		LogF.info(logger, "Iteration %.2f", val);
+		assertEquals("Iteration " + String.valueOf(val), capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.info with two arguments.
+	 */
+	public void testInfoTwoArg() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		LogF.info(logger, "%2$s, %1$s.", "World", "Hello");
+		assertEquals("Hello, World.", capture.getMessage());
+
+	}
+
+	/**
+	 * Test LogF.info with three arguments.
+	 */
+	public void testInfoThreeArg() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		LogF.info(logger, "%2$s%3$s %1$s.", "World", "Hello", ",");
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.info with Object[] argument.
+	 */
+	public void testInfoArrayArg() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		Object[] args = new Object[] { "World", "Hello", ",", "." };
+		LogF.info(logger, "%2$s%3$s %1$s%4$s", args);
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.info with vararg list.
+	 */
+	public void testInfoVararg() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		LogF.info(logger, "%2$s%3$s %1$s%4$s", "World", "Hello", ",", ".");
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.warn with null pattern.
+	 */
+	public void testWarnNullPattern() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		LogF.warn(logger, null);
+		assertNull(capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.warn with no-field pattern.
+	 */
+	public void testWarnNoArg() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		LogF.warn(logger, "Hello, World");
+		assertEquals("Hello, World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.warn with malformed pattern.
+	 */
+	public void testWarnBadPattern() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		LogF.warn(logger, "Hello, %.");
+		assertEquals("Hello, %.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.warn with missing argument.
+	 */
+	public void testWarnMissingArg() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		LogF.warn(logger, "Hello, %sWorld");
+		assertEquals("Hello, %sWorld", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.warn with single field pattern with string argument.
+	 */
+	public void testWarnString() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		LogF.warn(logger, "Hello, %s", "World");
+		assertEquals("Hello, World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.warn with single field pattern with null argument.
+	 */
+	public void testWarnNull() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		LogF.warn(logger, "Hello, %s", (Object) null);
+		assertEquals("Hello, null", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.warn with single field pattern with int argument.
+	 */
+	public void testWarnInt() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		int val = 42;
+		LogF.warn(logger, "Iteration %d", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.warn with single field pattern with byte argument.
+	 */
+	public void testWarnByte() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		byte val = 42;
+		LogF.warn(logger, "Iteration %d", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.warn with single field pattern with short argument.
+	 */
+	public void testWarnShort() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		short val = 42;
+		LogF.warn(logger, "Iteration %d", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.warn with single field pattern with long argument.
+	 */
+	public void testWarnLong() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		long val = 42;
+		LogF.warn(logger, "Iteration %d", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.warn with single field pattern with char argument.
+	 */
+	public void testWarnChar() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		char val = 'C';
+		LogF.warn(logger, "Iteration %c", val);
+		assertEquals("Iteration C", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.warn with single field pattern with boolean argument.
+	 */
+	public void testWarnBoolean() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		boolean val = true;
+		LogF.warn(logger, "Iteration %b", val);
+		assertEquals("Iteration true", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.warn with single field pattern with float argument.
+	 */
+	public void testWarnFloat() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		float val = 3.14f;
+		LogF.warn(logger, "Iteration %.2f", val);
+		assertEquals("Iteration " + String.valueOf(val), capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.warn with single field pattern with double argument.
+	 */
+	public void testWarnDouble() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		double val = 3.14;
+		LogF.warn(logger, "Iteration %.2f", val);
+		assertEquals("Iteration " + String.valueOf(val), capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.warn with two arguments.
+	 */
+	public void testWarnTwoArg() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		LogF.warn(logger, "%2$s, %1$s.", "World", "Hello");
+		assertEquals("Hello, World.", capture.getMessage());
+
+	}
+
+	/**
+	 * Test LogF.warn with three arguments.
+	 */
+	public void testWarnThreeArg() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		LogF.warn(logger, "%2$s%3$s %1$s.", "World", "Hello", ",");
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.warn with Object[] argument.
+	 */
+	public void testWarnArrayArg() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		Object[] args = new Object[] { "World", "Hello", ",", "." };
+		LogF.warn(logger, "%2$s%3$s %1$s%4$s", args);
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.warn with vararg list.
+	 */
+	public void testWarnVararg() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		LogF.warn(logger, "%2$s%3$s %1$s%4$s", "World", "Hello", ",", ".");
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.error with null pattern.
+	 */
+	public void testErrorNullPattern() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		LogF.error(logger, null);
+		assertNull(capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.error with no-field pattern.
+	 */
+	public void testErrorNoArg() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		LogF.error(logger, "Hello, World");
+		assertEquals("Hello, World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.error with malformed pattern.
+	 */
+	public void testErrorBadPattern() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		LogF.error(logger, "Hello, %.");
+		assertEquals("Hello, %.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.error with missing argument.
+	 */
+	public void testErrorMissingArg() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		LogF.error(logger, "Hello, %sWorld");
+		assertEquals("Hello, %sWorld", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.error with single field pattern with string argument.
+	 */
+	public void testErrorString() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		LogF.error(logger, "Hello, %s", "World");
+		assertEquals("Hello, World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.error with single field pattern with null argument.
+	 */
+	public void testErrorNull() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		LogF.error(logger, "Hello, %s", (Object) null);
+		assertEquals("Hello, null", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.error with single field pattern with int argument.
+	 */
+	public void testErrorInt() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		int val = 42;
+		LogF.error(logger, "Iteration %d", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.error with single field pattern with byte argument.
+	 */
+	public void testErrorByte() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		byte val = 42;
+		LogF.error(logger, "Iteration %d", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.error with single field pattern with short argument.
+	 */
+	public void testErrorShort() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		short val = 42;
+		LogF.error(logger, "Iteration %d", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.error with single field pattern with long argument.
+	 */
+	public void testErrorLong() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		long val = 42;
+		LogF.error(logger, "Iteration %d", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.error with single field pattern with char argument.
+	 */
+	public void testErrorChar() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		char val = 'C';
+		LogF.error(logger, "Iteration %c", val);
+		assertEquals("Iteration C", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.error with single field pattern with boolean argument.
+	 */
+	public void testErrorBoolean() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		boolean val = true;
+		LogF.error(logger, "Iteration %b", val);
+		assertEquals("Iteration true", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.error with single field pattern with float argument.
+	 */
+	public void testErrorFloat() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		float val = 3.14f;
+		LogF.error(logger, "Iteration %.2f", val);
+		assertEquals("Iteration " + String.valueOf(val), capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.error with single field pattern with double argument.
+	 */
+	public void testErrorDouble() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		double val = 3.14;
+		LogF.error(logger, "Iteration %.2f", val);
+		assertEquals("Iteration " + String.valueOf(val), capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.error with two arguments.
+	 */
+	public void testErrorTwoArg() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		LogF.error(logger, "%2$s, %1$s.", "World", "Hello");
+		assertEquals("Hello, World.", capture.getMessage());
+
+	}
+
+	/**
+	 * Test LogF.error with three arguments.
+	 */
+	public void testErrorThreeArg() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		LogF.error(logger, "%2$s%3$s %1$s.", "World", "Hello", ",");
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.error with Object[] argument.
+	 */
+	public void testErrorArrayArg() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		Object[] args = new Object[] { "World", "Hello", ",", "." };
+		LogF.error(logger, "%2$s%3$s %1$s%4$s", args);
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.error with vararg list.
+	 */
+	public void testErrorVararg() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		LogF.error(logger, "%2$s%3$s %1$s%4$s", "World", "Hello", ",", ".");
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.fatal with null pattern.
+	 */
+	public void testFatalNullPattern() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		LogF.fatal(logger, null);
+		assertNull(capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.fatal with no-field pattern.
+	 */
+	public void testFatalNoArg() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		LogF.fatal(logger, "Hello, World");
+		assertEquals("Hello, World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.fatal with malformed pattern.
+	 */
+	public void testFatalBadPattern() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		LogF.fatal(logger, "Hello, %.");
+		assertEquals("Hello, %.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.fatal with missing argument.
+	 */
+	public void testFatalMissingArg() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		LogF.fatal(logger, "Hello, %sWorld");
+		assertEquals("Hello, %sWorld", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.fatal with single field pattern with string argument.
+	 */
+	public void testFatalString() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		LogF.fatal(logger, "Hello, %s", "World");
+		assertEquals("Hello, World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.fatal with single field pattern with null argument.
+	 */
+	public void testFatalNull() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		LogF.fatal(logger, "Hello, %s", (Object) null);
+		assertEquals("Hello, null", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.fatal with single field pattern with int argument.
+	 */
+	public void testFatalInt() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		int val = 42;
+		LogF.fatal(logger, "Iteration %d", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.fatal with single field pattern with byte argument.
+	 */
+	public void testFatalByte() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		byte val = 42;
+		LogF.fatal(logger, "Iteration %d", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.fatal with single field pattern with short argument.
+	 */
+	public void testFatalShort() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		short val = 42;
+		LogF.fatal(logger, "Iteration %d", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.fatal with single field pattern with long argument.
+	 */
+	public void testFatalLong() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		long val = 42;
+		LogF.fatal(logger, "Iteration %d", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.fatal with single field pattern with char argument.
+	 */
+	public void testFatalChar() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		char val = 'C';
+		LogF.fatal(logger, "Iteration %c", val);
+		assertEquals("Iteration C", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.fatal with single field pattern with boolean argument.
+	 */
+	public void testFatalBoolean() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		boolean val = true;
+		LogF.fatal(logger, "Iteration %b", val);
+		assertEquals("Iteration true", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.fatal with single field pattern with float argument.
+	 */
+	public void testFatalFloat() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		float val = 3.14f;
+		LogF.fatal(logger, "Iteration %.2f", val);
+		assertEquals("Iteration " + String.valueOf(val), capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.fatal with single field pattern with double argument.
+	 */
+	public void testFatalDouble() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		double val = 3.14;
+		LogF.fatal(logger, "Iteration %.2f", val);
+		assertEquals("Iteration " + String.valueOf(val), capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.fatal with two arguments.
+	 */
+	public void testFatalTwoArg() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		LogF.fatal(logger, "%2$s, %1$s.", "World", "Hello");
+		assertEquals("Hello, World.", capture.getMessage());
+
+	}
+
+	/**
+	 * Test LogF.fatal with three arguments.
+	 */
+	public void testFatalThreeArg() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		LogF.fatal(logger, "%2$s%3$s %1$s.", "World", "Hello", ",");
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.fatal with Object[] argument.
+	 */
+	public void testFatalArrayArg() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		Object[] args = new Object[] { "World", "Hello", ",", "." };
+		LogF.fatal(logger, "%2$s%3$s %1$s%4$s", args);
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.fatal with vararg list.
+	 */
+	public void testFatalVararg() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		LogF.fatal(logger, "%2$s%3$s %1$s%4$s", "World", "Hello", ",", ".");
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+}

Propchange: logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogFTest.java
------------------------------------------------------------------------------
    svn:executable = 

Added: logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogFTraceTest.java
URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogFTraceTest.java?rev=368149&view=auto
==============================================================================
--- logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogFTraceTest.java (added)
+++ logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogFTraceTest.java Wed Jan 11 14:19:48 2006
@@ -0,0 +1,249 @@
+/*
+ * Copyright 1999,2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.formatter;
+
+import junit.framework.TestCase;
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+import org.apache.log4j.LogManager;
+
+/**
+ * Unit test for LogF.
+ */
+public class LogFTraceTest extends TestCase {
+	/**
+	 * Logger.
+	 */
+	private final Logger logger = Logger
+			.getLogger("org.apache.log4j.formatter.LogFTraceTest");
+
+	/**
+	 * Create the test case
+	 *
+	 * @param testName name of the test case
+	 */
+	public LogFTraceTest(String testName) {
+		super(testName);
+	}
+
+	/**
+	 * Post test clean up.
+	 */
+	public void tearDown() {
+		LogManager.resetConfiguration();
+	}
+
+	/**
+	 * Test LogF.trace with null pattern.
+	 */
+	public void testTraceNullPattern() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		LogF.trace(logger, null);
+		assertNull(capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.trace with no-field pattern.
+	 */
+	public void testTraceNoArg() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		LogF.trace(logger, "Hello, World");
+		assertEquals("Hello, World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.trace with malformed pattern.
+	 */
+	public void testTraceBadPattern() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		LogF.trace(logger, "Hello, %.");
+		assertEquals("Hello, %.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.trace with missing argument.
+	 */
+	public void testTraceMissingArg() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		LogF.trace(logger, "Hello, %sWorld");
+		assertEquals("Hello, %sWorld", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.trace with single field pattern with string argument.
+	 */
+	public void testTraceString() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		LogF.trace(logger, "Hello, %s", "World");
+		assertEquals("Hello, World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.trace with single field pattern with null argument.
+	 */
+	public void testTraceNull() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		LogF.trace(logger, "Hello, %s", (Object) null);
+		assertEquals("Hello, null", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.trace with single field pattern with int argument.
+	 */
+	public void testTraceInt() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		int val = 42;
+		LogF.trace(logger, "Iteration %d", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.trace with single field pattern with byte argument.
+	 */
+	public void testTraceByte() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		byte val = 42;
+		LogF.trace(logger, "Iteration %d", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.trace with single field pattern with short argument.
+	 */
+	public void testTraceShort() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		short val = 42;
+		LogF.trace(logger, "Iteration %d", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.trace with single field pattern with long argument.
+	 */
+	public void testTraceLong() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		long val = 42;
+		LogF.trace(logger, "Iteration %d", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.trace with single field pattern with char argument.
+	 */
+	public void testTraceChar() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		char val = 'C';
+		LogF.trace(logger, "Iteration %c", val);
+		assertEquals("Iteration C", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.trace with single field pattern with boolean argument.
+	 */
+	public void testTraceBoolean() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		boolean val = true;
+		LogF.trace(logger, "Iteration %b", val);
+		assertEquals("Iteration true", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.trace with single field pattern with float argument.
+	 */
+	public void testTraceFloat() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		float val = 3.14f;
+		LogF.trace(logger, "Iteration %.2f", val);
+		assertEquals("Iteration " + String.valueOf(val), capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.trace with single field pattern with double argument.
+	 */
+	public void testTraceDouble() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		double val = 3.14;
+		LogF.trace(logger, "Iteration %.2f", val);
+		assertEquals("Iteration " + String.valueOf(val), capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.trace with two arguments.
+	 */
+	public void testTraceTwoArg() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		LogF.trace(logger, "%2$s, %1$s.", "World", "Hello");
+		assertEquals("Hello, World.", capture.getMessage());
+
+	}
+
+	/**
+	 * Test LogF.trace with three arguments.
+	 */
+	public void testTraceThreeArg() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		LogF.trace(logger, "%2$s%3$s %1$s.", "World", "Hello", ",");
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.trace with Object[] argument.
+	 */
+	public void testTraceArrayArg() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		Object[] args = new Object[] { "World", "Hello", ",", "." };
+		LogF.trace(logger, "%2$s%3$s %1$s%4$s", args);
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.trace with null Object[] argument.
+	 */
+	public void testTraceNullArrayArg() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		Object[] args = null;
+		LogF.trace(logger, "%2$s%3$s %1$s%4$s", args);
+		assertEquals("nullnull nullnull", capture.getMessage());
+	}
+
+	/**
+	 * Test LogF.trace with vararg list.
+	 */
+	public void testTraceVararg() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		LogF.trace(logger, "%2$s%3$s %1$s%4$s", "World", "Hello", ",", ".");
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+}
\ No newline at end of file

Propchange: logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogFTraceTest.java
------------------------------------------------------------------------------
    svn:executable = 

Added: logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogMFTest.java
URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogMFTest.java?rev=368149&view=auto
==============================================================================
--- logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogMFTest.java (added)
+++ logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogMFTest.java Wed Jan 11 14:19:48 2006
@@ -0,0 +1,874 @@
+/*
+ * Copyright 1999,2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.formatter;
+
+import junit.framework.TestCase;
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+import org.apache.log4j.LogManager;
+
+/**
+ * Unit test for LogMF.
+ */
+public class LogMFTest extends TestCase {
+	/**
+	 * Logger.
+	 */
+	private final Logger logger = Logger
+			.getLogger("org.apache.log4j.formatter.LogMFTest");
+
+	/**
+	 * Create the test case
+	 *
+	 * @param testName name of the test case
+	 */
+	public LogMFTest(String testName) {
+		super(testName);
+	}
+
+	/**
+	 * Post test clean up.
+	 */
+	public void tearDown() {
+		LogManager.resetConfiguration();
+	}
+
+	/**
+	 * Test LogMF.debug with null pattern.
+	 */
+	public void testDebugNullPattern() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		LogMF.debug(logger, null);
+		assertNull(capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.debug with no-field pattern.
+	 */
+	public void testDebugNoArg() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		LogMF.debug(logger, "Hello, World");
+		assertEquals("Hello, World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.debug with malformed pattern.
+	 */
+	public void testDebugBadPattern() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		LogMF.debug(logger, "Hello, {.");
+		assertEquals("Hello, {.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.debug with missing argument.
+	 */
+	public void testDebugMissingArg() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		LogMF.debug(logger, "Hello, {0}World");
+		assertEquals("Hello, {0}World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.debug with single field pattern with string argument.
+	 */
+	public void testDebugString() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		LogMF.debug(logger, "Hello, {0}", "World");
+		assertEquals("Hello, World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.debug with single field pattern with null argument.
+	 */
+	public void testDebugNull() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		LogMF.debug(logger, "Hello, {0}", (Object) null);
+		assertEquals("Hello, null", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.debug with single field pattern with int argument.
+	 */
+	public void testDebugInt() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		int val = 42;
+		LogMF.debug(logger, "Iteration {0}", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.debug with single field pattern with byte argument.
+	 */
+	public void testDebugByte() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		byte val = 42;
+		LogMF.debug(logger, "Iteration {0}", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.debug with single field pattern with short argument.
+	 */
+	public void testDebugShort() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		short val = 42;
+		LogMF.debug(logger, "Iteration {0}", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.debug with single field pattern with long argument.
+	 */
+	public void testDebugLong() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		long val = 42;
+		LogMF.debug(logger, "Iteration {0}", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.debug with single field pattern with char argument.
+	 */
+	public void testDebugChar() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		char val = 'C';
+		LogMF.debug(logger, "Iteration {0}", val);
+		assertEquals("Iteration C", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.debug with single field pattern with boolean argument.
+	 */
+	public void testDebugBoolean() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		boolean val = true;
+		LogMF.debug(logger, "Iteration {0}", val);
+		assertEquals("Iteration true", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.debug with single field pattern with float argument.
+	 */
+	public void testDebugFloat() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		float val = 3.14f;
+		LogMF.debug(logger, "Iteration {0}", val);
+		assertEquals("Iteration 3.14", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.debug with single field pattern with double argument.
+	 */
+	public void testDebugDouble() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		double val = 3.14;
+		LogMF.debug(logger, "Iteration {0}", val);
+		assertEquals("Iteration 3.14", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.debug with two arguments.
+	 */
+	public void testDebugTwoArg() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		LogMF.debug(logger, "{1}, {0}.", "World", "Hello");
+		assertEquals("Hello, World.", capture.getMessage());
+
+	}
+
+	/**
+	 * Test LogMF.debug with three arguments.
+	 */
+	public void testDebugThreeArg() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		LogMF.debug(logger, "{1}{2} {0}.", "World", "Hello", ",");
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.debug with Object[] argument.
+	 */
+	public void testDebugArrayArg() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		Object[] args = new Object[] { "World", "Hello", ",", "." };
+		LogMF.debug(logger, "{1}{2} {0}{3}", args);
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.debug with null Object[] argument.
+	 */
+	public void testDebugNullArrayArg() {
+		LogCapture capture = new LogCapture(Level.DEBUG);
+		Object[] args = null;
+		LogMF.debug(logger, "{1}{2} {0}{3}", args);
+		assertEquals("{1}{2} {0}{3}", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.info with null pattern.
+	 */
+	public void testInfoNullPattern() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		LogMF.info(logger, null);
+		assertNull(capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.info with no-field pattern.
+	 */
+	public void testInfoNoArg() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		LogMF.info(logger, "Hello, World");
+		assertEquals("Hello, World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.info with malformed pattern.
+	 */
+	public void testInfoBadPattern() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		LogMF.info(logger, "Hello, {.");
+		assertEquals("Hello, {.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.info with missing argument.
+	 */
+	public void testInfoMissingArg() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		LogMF.info(logger, "Hello, {0}World");
+		assertEquals("Hello, {0}World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.info with single field pattern with string argument.
+	 */
+	public void testInfoString() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		LogMF.info(logger, "Hello, {0}", "World");
+		assertEquals("Hello, World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.info with single field pattern with null argument.
+	 */
+	public void testInfoNull() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		LogMF.info(logger, "Hello, {0}", (Object) null);
+		assertEquals("Hello, null", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.info with single field pattern with int argument.
+	 */
+	public void testInfoInt() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		int val = 42;
+		LogMF.info(logger, "Iteration {0}", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.info with single field pattern with byte argument.
+	 */
+	public void testInfoByte() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		byte val = 42;
+		LogMF.info(logger, "Iteration {0}", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.info with single field pattern with short argument.
+	 */
+	public void testInfoShort() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		short val = 42;
+		LogMF.info(logger, "Iteration {0}", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.info with single field pattern with long argument.
+	 */
+	public void testInfoLong() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		long val = 42;
+		LogMF.info(logger, "Iteration {0}", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.info with single field pattern with char argument.
+	 */
+	public void testInfoChar() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		char val = 'C';
+		LogMF.info(logger, "Iteration {0}", val);
+		assertEquals("Iteration C", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.info with single field pattern with boolean argument.
+	 */
+	public void testInfoBoolean() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		boolean val = true;
+		LogMF.info(logger, "Iteration {0}", val);
+		assertEquals("Iteration true", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.info with single field pattern with float argument.
+	 */
+	public void testInfoFloat() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		float val = 3.14f;
+		LogMF.info(logger, "Iteration {0}", val);
+		assertEquals("Iteration 3.14", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.info with single field pattern with double argument.
+	 */
+	public void testInfoDouble() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		double val = 3.14;
+		LogMF.info(logger, "Iteration {0}", val);
+		assertEquals("Iteration 3.14", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.info with two arguments.
+	 */
+	public void testInfoTwoArg() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		LogMF.info(logger, "{1}, {0}.", "World", "Hello");
+		assertEquals("Hello, World.", capture.getMessage());
+
+	}
+
+	/**
+	 * Test LogMF.info with three arguments.
+	 */
+	public void testInfoThreeArg() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		LogMF.info(logger, "{1}{2} {0}.", "World", "Hello", ",");
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.info with Object[] argument.
+	 */
+	public void testInfoArrayArg() {
+		LogCapture capture = new LogCapture(Level.INFO);
+		Object[] args = new Object[] { "World", "Hello", ",", "." };
+		LogMF.info(logger, "{1}{2} {0}{3}", args);
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.warn with null pattern.
+	 */
+	public void testWarnNullPattern() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		LogMF.warn(logger, null);
+		assertNull(capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.warn with no-field pattern.
+	 */
+	public void testWarnNoArg() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		LogMF.warn(logger, "Hello, World");
+		assertEquals("Hello, World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.warn with malformed pattern.
+	 */
+	public void testWarnBadPattern() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		LogMF.warn(logger, "Hello, {.");
+		assertEquals("Hello, {.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.warn with missing argument.
+	 */
+	public void testWarnMissingArg() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		LogMF.warn(logger, "Hello, {0}World");
+		assertEquals("Hello, {0}World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.warn with single field pattern with string argument.
+	 */
+	public void testWarnString() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		LogMF.warn(logger, "Hello, {0}", "World");
+		assertEquals("Hello, World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.warn with single field pattern with null argument.
+	 */
+	public void testWarnNull() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		LogMF.warn(logger, "Hello, {0}", (Object) null);
+		assertEquals("Hello, null", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.warn with single field pattern with int argument.
+	 */
+	public void testWarnInt() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		int val = 42;
+		LogMF.warn(logger, "Iteration {0}", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.warn with single field pattern with byte argument.
+	 */
+	public void testWarnByte() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		byte val = 42;
+		LogMF.warn(logger, "Iteration {0}", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.warn with single field pattern with short argument.
+	 */
+	public void testWarnShort() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		short val = 42;
+		LogMF.warn(logger, "Iteration {0}", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.warn with single field pattern with long argument.
+	 */
+	public void testWarnLong() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		long val = 42;
+		LogMF.warn(logger, "Iteration {0}", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.warn with single field pattern with char argument.
+	 */
+	public void testWarnChar() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		char val = 'C';
+		LogMF.warn(logger, "Iteration {0}", val);
+		assertEquals("Iteration C", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.warn with single field pattern with boolean argument.
+	 */
+	public void testWarnBoolean() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		boolean val = true;
+		LogMF.warn(logger, "Iteration {0}", val);
+		assertEquals("Iteration true", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.warn with single field pattern with float argument.
+	 */
+	public void testWarnFloat() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		float val = 3.14f;
+		LogMF.warn(logger, "Iteration {0}", val);
+		assertEquals("Iteration 3.14", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.debug with single field pattern with double argument.
+	 */
+	public void testWarnDouble() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		double val = 3.14;
+		LogMF.warn(logger, "Iteration {0}", val);
+		assertEquals("Iteration 3.14", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.warn with two arguments.
+	 */
+	public void testWarnTwoArg() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		LogMF.warn(logger, "{1}, {0}.", "World", "Hello");
+		assertEquals("Hello, World.", capture.getMessage());
+
+	}
+
+	/**
+	 * Test LogMF.warn with three arguments.
+	 */
+	public void testWarnThreeArg() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		LogMF.warn(logger, "{1}{2} {0}.", "World", "Hello", ",");
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.warn with Object[] argument.
+	 */
+	public void testWarnArrayArg() {
+		LogCapture capture = new LogCapture(Level.WARN);
+		Object[] args = new Object[] { "World", "Hello", ",", "." };
+		LogMF.warn(logger, "{1}{2} {0}{3}", args);
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.error with null pattern.
+	 */
+	public void testErrorNullPattern() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		LogMF.error(logger, null);
+		assertNull(capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.error with no-field pattern.
+	 */
+	public void testErrorNoArg() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		LogMF.error(logger, "Hello, World");
+		assertEquals("Hello, World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.error with malformed pattern.
+	 */
+	public void testErrorBadPattern() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		LogMF.error(logger, "Hello, {.");
+		assertEquals("Hello, {.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.error with missing argument.
+	 */
+	public void testErrorMissingArg() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		LogMF.error(logger, "Hello, {0}World");
+		assertEquals("Hello, {0}World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.error with single field pattern with string argument.
+	 */
+	public void testErrorString() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		LogMF.error(logger, "Hello, {0}", "World");
+		assertEquals("Hello, World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.error with single field pattern with null argument.
+	 */
+	public void testErrorNull() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		LogMF.error(logger, "Hello, {0}", (Object) null);
+		assertEquals("Hello, null", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.error with single field pattern with int argument.
+	 */
+	public void testErrorInt() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		int val = 42;
+		LogMF.error(logger, "Iteration {0}", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.error with single field pattern with byte argument.
+	 */
+	public void testErrorByte() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		byte val = 42;
+		LogMF.error(logger, "Iteration {0}", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.error with single field pattern with short argument.
+	 */
+	public void testErrorShort() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		short val = 42;
+		LogMF.error(logger, "Iteration {0}", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.error with single field pattern with long argument.
+	 */
+	public void testErrorLong() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		long val = 42;
+		LogMF.error(logger, "Iteration {0}", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.error with single field pattern with char argument.
+	 */
+	public void testErrorChar() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		char val = 'C';
+		LogMF.error(logger, "Iteration {0}", val);
+		assertEquals("Iteration C", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.error with single field pattern with boolean argument.
+	 */
+	public void testErrorBoolean() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		boolean val = true;
+		LogMF.error(logger, "Iteration {0}", val);
+		assertEquals("Iteration true", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.error with single field pattern with float argument.
+	 */
+	public void testErrorFloat() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		float val = 3.14f;
+		LogMF.error(logger, "Iteration {0}", val);
+		assertEquals("Iteration 3.14", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.debug with single field pattern with double argument.
+	 */
+	public void testErrorDouble() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		double val = 3.14;
+		LogMF.error(logger, "Iteration {0}", val);
+		assertEquals("Iteration 3.14", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.error with two arguments.
+	 */
+	public void testErrorTwoArg() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		LogMF.error(logger, "{1}, {0}.", "World", "Hello");
+		assertEquals("Hello, World.", capture.getMessage());
+
+	}
+
+	/**
+	 * Test LogMF.error with three arguments.
+	 */
+	public void testErrorThreeArg() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		LogMF.error(logger, "{1}{2} {0}.", "World", "Hello", ",");
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.error with Object[] argument.
+	 */
+	public void testErrorArrayArg() {
+		LogCapture capture = new LogCapture(Level.ERROR);
+		Object[] args = new Object[] { "World", "Hello", ",", "." };
+		LogMF.error(logger, "{1}{2} {0}{3}", args);
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.fatal with null pattern.
+	 */
+	public void testFatalNullPattern() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		LogMF.fatal(logger, null);
+		assertNull(capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.fatal with no-field pattern.
+	 */
+	public void testFatalNoArg() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		LogMF.fatal(logger, "Hello, World");
+		assertEquals("Hello, World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.fatal with malformed pattern.
+	 */
+	public void testFatalBadPattern() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		LogMF.fatal(logger, "Hello, {.");
+		assertEquals("Hello, {.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.fatal with missing argument.
+	 */
+	public void testFatalMissingArg() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		LogMF.fatal(logger, "Hello, {0}World");
+		assertEquals("Hello, {0}World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.fatal with single field pattern with string argument.
+	 */
+	public void testFatalString() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		LogMF.fatal(logger, "Hello, {0}", "World");
+		assertEquals("Hello, World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.fatal with single field pattern with null argument.
+	 */
+	public void testFatalNull() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		LogMF.fatal(logger, "Hello, {0}", (Object) null);
+		assertEquals("Hello, null", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.fatal with single field pattern with int argument.
+	 */
+	public void testFatalInt() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		int val = 42;
+		LogMF.fatal(logger, "Iteration {0}", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.fatal with single field pattern with byte argument.
+	 */
+	public void testFatalByte() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		byte val = 42;
+		LogMF.fatal(logger, "Iteration {0}", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.fatal with single field pattern with short argument.
+	 */
+	public void testFatalShort() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		short val = 42;
+		LogMF.fatal(logger, "Iteration {0}", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.fatal with single field pattern with long argument.
+	 */
+	public void testFatalLong() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		long val = 42;
+		LogMF.fatal(logger, "Iteration {0}", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.fatal with single field pattern with char argument.
+	 */
+	public void testFatalChar() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		char val = 'C';
+		LogMF.fatal(logger, "Iteration {0}", val);
+		assertEquals("Iteration C", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.fatal with single field pattern with boolean argument.
+	 */
+	public void testFatalBoolean() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		boolean val = true;
+		LogMF.fatal(logger, "Iteration {0}", val);
+		assertEquals("Iteration true", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.fatal with single field pattern with float argument.
+	 */
+	public void testFatalFloat() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		float val = 3.14f;
+		LogMF.fatal(logger, "Iteration {0}", val);
+		assertEquals("Iteration 3.14", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.fatal with single field pattern with double argument.
+	 */
+	public void testFatalDouble() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		double val = 3.14;
+		LogMF.fatal(logger, "Iteration {0}", val);
+		assertEquals("Iteration 3.14", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.fatal with two arguments.
+	 */
+	public void testFatalTwoArg() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		LogMF.fatal(logger, "{1}, {0}.", "World", "Hello");
+		assertEquals("Hello, World.", capture.getMessage());
+
+	}
+
+	/**
+	 * Test LogMF.fatal with three arguments.
+	 */
+	public void testFatalThreeArg() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		LogMF.fatal(logger, "{1}{2} {0}.", "World", "Hello", ",");
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.fatal with Object[] argument.
+	 */
+	public void testFatalArrayArg() {
+		LogCapture capture = new LogCapture(Level.FATAL);
+		Object[] args = new Object[] { "World", "Hello", ",", "." };
+		LogMF.fatal(logger, "{1}{2} {0}{3}", args);
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+}

Propchange: logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogMFTest.java
------------------------------------------------------------------------------
    svn:executable = 

Added: logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogMFTraceTest.java
URL: http://svn.apache.org/viewcvs/logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogMFTraceTest.java?rev=368149&view=auto
==============================================================================
--- logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogMFTraceTest.java (added)
+++ logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogMFTraceTest.java Wed Jan 11 14:19:48 2006
@@ -0,0 +1,240 @@
+/*
+ * Copyright 1999,2006 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.log4j.formatter;
+
+import junit.framework.TestCase;
+import org.apache.log4j.Logger;
+import org.apache.log4j.Level;
+import org.apache.log4j.LogManager;
+
+/**
+ * Unit test for LogMF.
+ */
+public class LogMFTraceTest extends TestCase {
+	/**
+	 * Logger.
+	 */
+	private final Logger logger = Logger
+			.getLogger("org.apache.log4j.formatter.LogMFTraceTest");
+
+	/**
+	 * Create the test case
+	 *
+	 * @param testName name of the test case
+	 */
+	public LogMFTraceTest(String testName) {
+		super(testName);
+	}
+
+	/**
+	 * Post test clean up.
+	 */
+	public void tearDown() {
+		LogManager.resetConfiguration();
+	}
+
+	/**
+	 * Test LogMF.trace with null pattern.
+	 */
+	public void testTraceNullPattern() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		LogMF.trace(logger, null);
+		assertNull(capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.trace with no-field pattern.
+	 */
+	public void testTraceNoArg() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		LogMF.trace(logger, "Hello, World");
+		assertEquals("Hello, World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.trace with malformed pattern.
+	 */
+	public void testTraceBadPattern() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		LogMF.trace(logger, "Hello, {.");
+		assertEquals("Hello, {.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.trace with missing argument.
+	 */
+	public void testTraceMissingArg() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		LogMF.trace(logger, "Hello, {0}World");
+		assertEquals("Hello, {0}World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.trace with single field pattern with string argument.
+	 */
+	public void testTraceString() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		LogMF.trace(logger, "Hello, {0}", "World");
+		assertEquals("Hello, World", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.trace with single field pattern with null argument.
+	 */
+	public void testTraceNull() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		LogMF.trace(logger, "Hello, {0}", (Object) null);
+		assertEquals("Hello, null", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.trace with single field pattern with int argument.
+	 */
+	public void testTraceInt() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		int val = 42;
+		LogMF.trace(logger, "Iteration {0}", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.trace with single field pattern with byte argument.
+	 */
+	public void testTraceByte() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		byte val = 42;
+		LogMF.trace(logger, "Iteration {0}", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.trace with single field pattern with short argument.
+	 */
+	public void testTraceShort() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		short val = 42;
+		LogMF.trace(logger, "Iteration {0}", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.trace with single field pattern with long argument.
+	 */
+	public void testTraceLong() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		long val = 42;
+		LogMF.trace(logger, "Iteration {0}", val);
+		assertEquals("Iteration 42", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.trace with single field pattern with char argument.
+	 */
+	public void testTraceChar() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		char val = 'C';
+		LogMF.trace(logger, "Iteration {0}", val);
+		assertEquals("Iteration C", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.trace with single field pattern with boolean argument.
+	 */
+	public void testTraceBoolean() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		boolean val = true;
+		LogMF.trace(logger, "Iteration {0}", val);
+		assertEquals("Iteration true", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.trace with single field pattern with float argument.
+	 */
+	public void testTraceFloat() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		float val = 3.14f;
+		LogMF.trace(logger, "Iteration {0}", val);
+		assertEquals("Iteration 3.14", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.trace with single field pattern with double argument.
+	 */
+	public void testTraceDouble() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		double val = 3.14;
+		LogMF.trace(logger, "Iteration {0}", val);
+		assertEquals("Iteration 3.14", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.trace with two arguments.
+	 */
+	public void testTraceTwoArg() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		LogMF.trace(logger, "{1}, {0}.", "World", "Hello");
+		assertEquals("Hello, World.", capture.getMessage());
+
+	}
+
+	/**
+	 * Test LogMF.trace with three arguments.
+	 */
+	public void testTraceThreeArg() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		LogMF.trace(logger, "{1}{2} {0}.", "World", "Hello", ",");
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.trace with Object[] argument.
+	 */
+	public void testTraceArrayArg() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		Object[] args = new Object[] { "World", "Hello", ",", "." };
+		LogMF.trace(logger, "{1}{2} {0}{3}", args);
+		assertEquals("Hello, World.", capture.getMessage());
+	}
+
+	/**
+	 * Test LogMF.trace with null Object[] argument.
+	 */
+	public void testTraceNullArrayArg() {
+		LogCapture capture = new LogCapture(Level.TRACE);
+		logger.setLevel(Level.TRACE);
+		Object[] args = null;
+		LogMF.trace(logger, "{1}{2} {0}{3}", args);
+		assertEquals("{1}{2} {0}{3}", capture.getMessage());
+	}
+
+}

Propchange: logging/sandbox/log4j/formatter/src/test/java/org/apache/log4j/formatter/LogMFTraceTest.java
------------------------------------------------------------------------------
    svn:executable = 



---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org