001/*
002 *  jDTAUS Banking RI CurrencyDirectory
003 *  Copyright (C) 2005 Christian Schulte
004 *  <cs@schulte.it>
005 *
006 *  This library is free software; you can redistribute it and/or
007 *  modify it under the terms of the GNU Lesser General Public
008 *  License as published by the Free Software Foundation; either
009 *  version 2.1 of the License, or any later version.
010 *
011 *  This library is distributed in the hope that it will be useful,
012 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
013 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014 *  Lesser General Public License for more details.
015 *
016 *  You should have received a copy of the GNU Lesser General Public
017 *  License along with this library; if not, write to the Free Software
018 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
019 *
020 */
021package org.jdtaus.banking.ri.currencydir.test;
022
023import java.util.Date;
024import junit.framework.Assert;
025import junit.framework.TestCase;
026import org.jdtaus.banking.ri.currencydir.JaxpCurrency;
027
028/**
029 * Tests the {@link JaxpCurrency} implementation.
030 *
031 * @author <a href="mailto:cs@schulte.it">Christian Schulte</a>
032 * @version $JDTAUS: JaxpCurrencyTest.java 8723 2012-10-04 20:09:53Z schulte $
033 */
034public class JaxpCurrencyTest extends TestCase
035{
036
037    public void testObject() throws Exception
038    {
039        JaxpCurrency c1 = new JaxpCurrency();
040        JaxpCurrency c2 = new JaxpCurrency();
041
042        Assert.assertEquals( c1, c2 );
043        Assert.assertEquals( c1.hashCode(), c2.hashCode() );
044
045        c2.setDtausCode( new Character( 'X' ) );
046
047        Assert.assertFalse( c1.equals( c2 ) );
048        Assert.assertFalse( c1.hashCode() == c2.hashCode() );
049
050        c2.setDtausCode( null );
051        c2.setEndDate( new Date() );
052
053        Assert.assertFalse( c1.equals( c2 ) );
054        Assert.assertFalse( c1.hashCode() == c2.hashCode() );
055
056        c2.setEndDate( null );
057        c2.setIsoCode( "DEM" );
058
059        Assert.assertFalse( c1.equals( c2 ) );
060        Assert.assertFalse( c1.hashCode() == c2.hashCode() );
061
062        c2.setIsoCode( null );
063        c2.setStartDate( new Date() );
064
065        Assert.assertFalse( c1.equals( c2 ) );
066        Assert.assertFalse( c1.hashCode() == c2.hashCode() );
067
068        c2.setStartDate( null );
069
070        Assert.assertEquals( c1, c2 );
071        Assert.assertEquals( c1.hashCode(), c2.hashCode() );
072    }
073
074}