/*
 * Tapestry Web Application Framework
 * Copyright (c) 2002 by Howard Lewis Ship 
 *
 * mailto:hship@users.sf.net
 * 
 * This library is free software.
 * 
 * You may redistribute it and/or modify it under the terms of the GNU
 * Lesser General Public License as published by the Free Software Foundation.
 *
 * Version 2.1 of the license should be included with this distribution in
 * the file LICENSE, as well as License.html. If the license is not
 * included with this distribution, you may find a copy at the FSF web
 * site at 'www.gnu.org' or 'www.fsf.org', or you may write to the
 * Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139 USA.
 *
 * 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.
 *
 */
package net.sf.tapestry.junit.utils;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;

import com.primix.tapestry.spec.AssetType;
import com.primix.tapestry.util.Enum;

import junit.framework.TestCase;

/**
 *  Tests the ability of an {@link Enum} to be serialized and deserialized properly.
 * 
 *  @author Howard Lewis Ship
 *  @version $Id$
 * 
 **/

public class TestEnum extends TestCase
{

	public TestEnum(String name)
	{
		super(name);
	}

    public void testSerialization()
    throws Exception
    {
        AssetType start = AssetType.EXTERNAL;
        
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(bos);
        
        oos.writeObject(start);
        
        oos.close();
        
        ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
        ObjectInputStream ois = new ObjectInputStream(bis);
        
        AssetType result = (AssetType)ois.readObject();
        
        assertEquals(start, result);
        assertSame(start, result);   
    }
}

Add new test for testing Enum serialization / deserialization
Add new test for testing Enum serialization / deserialization


git-svn-id: 1006245cb1bdea2fd4c9095e50bc2ef3d167b18c@242491 13f79535-47bb-0310-9956-ffa450edef68
