/*

License $Id: MapAdaptTest.java,v 1.2 2001/05/11 16:45:17 Hendrik Exp $

Copyright (c) 2001 tagtraum industries.

The sixbs library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

For LGPL see <http://www.fsf.org/copyleft/lesser.txt>

We encourage your feedback and suggestions and want to use your feedback to
improve the Software. Send all such feedback to:
feedback@tagtraum.com

For more information on tagtraum industries, Hendrik Schreiber and sixbs
please see <http://www.tagtraum.com/>.

*/

package com.tagtraum.sixbs.adapters.util.test;

import com.tagtraum.sixbs.*;
import com.tagtraum.sixbs.adapters.util.*;
import junit.framework.*;
import java.io.*;
import java.util.*;

/**
 * 
 * 
 * @author 	Hendrik Schreiber
 * @version $Id: MapAdaptTest.java,v 1.2 2001/05/11 16:45:17 Hendrik Exp $
 */
public class MapAdaptTest extends TestCase {

    /**
     * Source-Version
     */
    public static String	vcid = 
	"$Id: MapAdaptTest.java,v 1.2 2001/05/11 16:45:17 Hendrik Exp $";
        
    public MapAdaptTest(String name) {
        super(name);
    }
    
    public void testWriteMap() throws IOException {
        CharArrayWriter out = new CharArrayWriter();
        SIXBSWriter writer = new SIXBSWriter(out, true);
        HashMap map = new HashMap();
        map.put("aKey", "aValue");
        map.put("anotherKey", "anotherValue");
        writer.writeObject(map);
        //System.out.println(out.toString());
        assert("Make sure, a HashMap is written correctly.", out.toString().equals("<com.tagtraum.sixbs.adapters.util.HashMapAdapt id=\"0\"><mapEntries><com.tagtraum.sixbs.TypedArray type=\"com.tagtraum.sixbs.adapters.util.MapEntry\" array=\"false\"><com.tagtraum.sixbs.adapters.util.MapEntry id=\"1\"><key><java.lang.String id=\"2\">anotherKey</java.lang.String></key><value><java.lang.String id=\"3\">anotherValue</java.lang.String></value></com.tagtraum.sixbs.adapters.util.MapEntry><com.tagtraum.sixbs.adapters.util.MapEntry id=\"4\"><key><java.lang.String id=\"5\">aKey</java.lang.String></key><value><java.lang.String id=\"6\">aValue</java.lang.String></value></com.tagtraum.sixbs.adapters.util.MapEntry></com.tagtraum.sixbs.TypedArray></mapEntries></com.tagtraum.sixbs.adapters.util.HashMapAdapt>"));
    }

    public static TestSuite suite() {
        return new TestSuite(MapAdaptTest.class);
    }
    
    public static void main(String[] args) {
        junit.textui.TestRunner.run(suite());
    }
    
}