--- DefaultToStringStyleTest.java	Fri Aug  7 11:03:35 2009
+++ StandardToStringStyleTest.java	Fri Aug  7 11:03:09 2009
@@ -1,21 +1,59 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You 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.
+/* ====================================================================
+ * The Apache Software License, Version 1.1
+ *
+ * Copyright (c) 2002 The Apache Software Foundation.  All rights
+ * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution, if
+ *    any, must include the following acknowlegement:
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowlegement may appear in the software itself,
+ *    if and wherever such third-party acknowlegements normally appear.
+ *
+ * 4. The names "The Jakarta Project", "Commons", and "Apache Software
+ *    Foundation" must not be used to endorse or promote products derived
+ *    from this software without prior written permission. For written
+ *    permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache"
+ *    nor may "Apache" appear in their names without prior written
+ *    permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ====================================================================
+ *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation.  For more
+ * information on the Apache Software Foundation, please see
+ * <http://www.apache.org/>.
  */
-package org.apache.commons.lang.builder;
+// package org.apache.commons.lang.builder
 
+package org.apache.commons.lang.builder;
 import java.util.ArrayList;
 import java.util.HashMap;
 
@@ -23,19 +61,33 @@
 import junit.framework.TestCase;
 import junit.framework.TestSuite;
 import junit.textui.TestRunner;
-
 /**
- * Unit tests {@link org.apache.commons.lang.builder.DefaultToStringStyleTest}.
+ * Unit tests {@link org.apache.commons.lang.ToStringStyle}.
  *
  * @author <a href="mailto:scolebourne@joda.org">Stephen Colebourne</a>
- * @version $Id: DefaultToStringStyleTest.java 437554 2006-08-28 06:21:41Z bayard $
+ * @version $Id: StandardToStringStyleTest.java,v 1.1 2002/09/17 22:07:50 scolebourne Exp $
  */
-public class DefaultToStringStyleTest extends TestCase {
+public class StandardToStringStyleTest extends TestCase {
 
     private final Integer base = new Integer(5);
-    private final String baseStr = base.getClass().getName() + "@" + Integer.toHexString(System.identityHashCode(base));
+    private final String baseStr = "Integer";
     
-    public DefaultToStringStyleTest(String name) {
+    private static final StandardToStringStyle STYLE = new StandardToStringStyle();
+    
+    static {
+        STYLE.setShortClassName(true);
+        STYLE.setUseIdentityHashCode(false);
+        STYLE.setArrayStart("[");
+        STYLE.setArraySeparator(", ");
+        STYLE.setArrayEnd("]");
+        STYLE.setNullText("%NULL%");
+        STYLE.setSizeStartText("%SIZE=");
+        STYLE.setSizeEndText("%");
+        STYLE.setSummaryObjectStartText("%");
+        STYLE.setSummaryObjectEndText("%");
+    }
+    
+    public StandardToStringStyleTest(String name) {
         super(name);
     }
 
@@ -44,19 +96,19 @@
     }
 
     public static Test suite() {
-        TestSuite suite = new TestSuite(DefaultToStringStyleTest.class);
-        suite.setName("DefaultToStringStyle Tests");
+        TestSuite suite = new TestSuite(StandardToStringStyleTest.class);
+        suite.setName("StandardToStringStyle Tests");
         return suite;
     }
 
     protected void setUp() throws Exception {
         super.setUp();
-        ToStringBuilder.setDefaultStyle(ToStringStyle.DEFAULT_STYLE);
+        ToStringBuilder.setDefaultStyle(STYLE);
     }
 
     protected void tearDown() throws Exception {
         super.tearDown();
-        ToStringBuilder.setDefaultStyle(ToStringStyle.DEFAULT_STYLE);
+        ToStringBuilder.setDefaultStyle(STYLE);
     }
 
     //----------------------------------------------------------------
@@ -65,30 +117,21 @@
         assertEquals(baseStr + "[]", new ToStringBuilder(base).toString());
     }
 
-    public void testAppendSuper() {
-        assertEquals(baseStr + "[]", new ToStringBuilder(base).appendSuper("Integer@8888[]").toString());
-        assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).appendSuper("Integer@8888[<null>]").toString());
-        
-        assertEquals(baseStr + "[a=hello]", new ToStringBuilder(base).appendSuper("Integer@8888[]").append("a", "hello").toString());
-        assertEquals(baseStr + "[<null>,a=hello]", new ToStringBuilder(base).appendSuper("Integer@8888[<null>]").append("a", "hello").toString());
-        assertEquals(baseStr + "[a=hello]", new ToStringBuilder(base).appendSuper(null).append("a", "hello").toString());
-    }
-    
     public void testObject() {
         Integer i3 = new Integer(3);
         Integer i4 = new Integer(4);
-        assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).append((Object) null).toString());
+        assertEquals(baseStr + "[%NULL%]", new ToStringBuilder(base).append((Object) null).toString());
         assertEquals(baseStr + "[3]", new ToStringBuilder(base).append(i3).toString());
-        assertEquals(baseStr + "[a=<null>]", new ToStringBuilder(base).append("a", (Object) null).toString());
+        assertEquals(baseStr + "[a=%NULL%]", new ToStringBuilder(base).append("a", (Object) null).toString());
         assertEquals(baseStr + "[a=3]", new ToStringBuilder(base).append("a", i3).toString());
         assertEquals(baseStr + "[a=3,b=4]", new ToStringBuilder(base).append("a", i3).append("b", i4).toString());
-        assertEquals(baseStr + "[a=<Integer>]", new ToStringBuilder(base).append("a", i3, false).toString());
-        assertEquals(baseStr + "[a=<size=0>]", new ToStringBuilder(base).append("a", new ArrayList(), false).toString());
+        assertEquals(baseStr + "[a=%Integer%]", new ToStringBuilder(base).append("a", i3, false).toString());
+        assertEquals(baseStr + "[a=%SIZE=0%]", new ToStringBuilder(base).append("a", new ArrayList(), false).toString());
         assertEquals(baseStr + "[a=[]]", new ToStringBuilder(base).append("a", new ArrayList(), true).toString());
-        assertEquals(baseStr + "[a=<size=0>]", new ToStringBuilder(base).append("a", new HashMap(), false).toString());
+        assertEquals(baseStr + "[a=%SIZE=0%]", new ToStringBuilder(base).append("a", new HashMap(), false).toString());
         assertEquals(baseStr + "[a={}]", new ToStringBuilder(base).append("a", new HashMap(), true).toString());
-        assertEquals(baseStr + "[a=<size=0>]", new ToStringBuilder(base).append("a", (Object) new String[0], false).toString());
-        assertEquals(baseStr + "[a={}]", new ToStringBuilder(base).append("a", (Object) new String[0], true).toString());
+        assertEquals(baseStr + "[a=%SIZE=0%]", new ToStringBuilder(base).append("a", (Object) new String[0], false).toString());
+        assertEquals(baseStr + "[a=[]]", new ToStringBuilder(base).append("a", (Object) new String[0], true).toString());
     }
 
     public void testLong() {
@@ -99,29 +142,29 @@
 
     public void testObjectArray() {
         Object[] array = new Object[] {null, base, new int[] {3, 6}};
-        assertEquals(baseStr + "[{<null>,5,{3,6}}]", new ToStringBuilder(base).append(array).toString());
-        assertEquals(baseStr + "[{<null>,5,{3,6}}]", new ToStringBuilder(base).append((Object) array).toString());
+        assertEquals(baseStr + "[[%NULL%, 5, [3, 6]]]", new ToStringBuilder(base).append(array).toString());
+        assertEquals(baseStr + "[[%NULL%, 5, [3, 6]]]", new ToStringBuilder(base).append((Object) array).toString());
         array = null;
-        assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).append(array).toString());
-        assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).append((Object) array).toString());
+        assertEquals(baseStr + "[%NULL%]", new ToStringBuilder(base).append(array).toString());
+        assertEquals(baseStr + "[%NULL%]", new ToStringBuilder(base).append((Object) array).toString());
     }
 
     public void testLongArray() {
         long[] array = new long[] {1, 2, -3, 4};
-        assertEquals(baseStr + "[{1,2,-3,4}]", new ToStringBuilder(base).append(array).toString());
-        assertEquals(baseStr + "[{1,2,-3,4}]", new ToStringBuilder(base).append((Object) array).toString());
+        assertEquals(baseStr + "[[1, 2, -3, 4]]", new ToStringBuilder(base).append(array).toString());
+        assertEquals(baseStr + "[[1, 2, -3, 4]]", new ToStringBuilder(base).append((Object) array).toString());
         array = null;
-        assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).append(array).toString());
-        assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).append((Object) array).toString());
+        assertEquals(baseStr + "[%NULL%]", new ToStringBuilder(base).append(array).toString());
+        assertEquals(baseStr + "[%NULL%]", new ToStringBuilder(base).append((Object) array).toString());
     }
 
     public void testLongArrayArray() {
         long[][] array = new long[][] {{1, 2}, null, {5}};
-        assertEquals(baseStr + "[{{1,2},<null>,{5}}]", new ToStringBuilder(base).append(array).toString());
-        assertEquals(baseStr + "[{{1,2},<null>,{5}}]", new ToStringBuilder(base).append((Object) array).toString());
+        assertEquals(baseStr + "[[[1, 2], %NULL%, [5]]]", new ToStringBuilder(base).append(array).toString());
+        assertEquals(baseStr + "[[[1, 2], %NULL%, [5]]]", new ToStringBuilder(base).append((Object) array).toString());
         array = null;
-        assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).append(array).toString());
-        assertEquals(baseStr + "[<null>]", new ToStringBuilder(base).append((Object) array).toString());
+        assertEquals(baseStr + "[%NULL%]", new ToStringBuilder(base).append(array).toString());
+        assertEquals(baseStr + "[%NULL%]", new ToStringBuilder(base).append((Object) array).toString());
     }
 
 }
