Package org.jpos.util

Source Code of org.jpos.util.ISOFieldDeepCopierTest

package org.jpos.util;

import junit.framework.TestCase;

import org.jpos.iso.ISOField;

/**
* $Revision: 23416 $
* $Date: 2007-03-14 00:14:09 +0000 (Wed, 14 Mar 2007) $
* $Author: nsmith $
*/
public final class ISOFieldDeepCopierTest extends TestCase {

    private ISOFieldDeepCopier copier;
   
    protected void setUp() throws Exception {
        copier = new ISOFieldDeepCopier();
    }
   
    public void testDoDeepCopyOfISOBinaryField() throws Exception {
        String fieldContent = "firstField";

        ISOField fieldWhichWillBeModified = new ISOField(8, fieldContent);
        ISOField fieldWhoseValueShouldNotChange = copier.doDeepCopy(fieldWhichWillBeModified);

        String updatedFieldContent = fieldContent + "a";
        fieldWhichWillBeModified.setFieldNumber(7);
        fieldWhichWillBeModified.setValue(updatedFieldContent);
       
        assertNotNull(fieldWhichWillBeModified);
        assertNotNull(fieldWhoseValueShouldNotChange);
        assertNotSame(fieldWhichWillBeModified, fieldWhoseValueShouldNotChange);
        assertEquals(updatedFieldContent, fieldWhichWillBeModified.getValue());
        assertEquals(fieldContent, fieldWhoseValueShouldNotChange.getValue());
        ISOComponentEqualityTester.assertNotEquals(fieldWhichWillBeModified, fieldWhoseValueShouldNotChange);
    }
}
TOP

Related Classes of org.jpos.util.ISOFieldDeepCopierTest

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.