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);
}
}