1 2 17 18 package org.apache.poi.hssf.record; 19 20 import junit.framework.TestCase; 21 22 import org.apache.poi.hssf.record.MergeCellsRecord.MergedRegion; 23 24 29 public class TestMergeCellsRecord extends TestCase { 30 31 35 public void testCloneReferences() throws Exception { 36 MergeCellsRecord merge = new MergeCellsRecord(); 37 merge.addArea(0, (short)0, 1, (short)2); 38 MergeCellsRecord clone = (MergeCellsRecord)merge.clone(); 39 40 assertNotSame("Merged and cloned objects are the same", merge, clone); 41 42 MergedRegion mergeRegion = merge.getAreaAt(0); 43 MergedRegion cloneRegion = clone.getAreaAt(0); 44 assertNotSame("Should not point to same objects when cloning", mergeRegion, cloneRegion); 45 assertEquals("New Clone Row From doesnt match", mergeRegion.row_from, cloneRegion.row_from); 46 assertEquals("New Clone Row To doesnt match", mergeRegion.row_to, cloneRegion.row_to); 47 assertEquals("New Clone Col From doesnt match", mergeRegion.col_from, cloneRegion.col_from); 48 assertEquals("New Clone Col To doesnt match", mergeRegion.col_to, cloneRegion.col_to); 49 50 merge.removeAreaAt(0); 51 assertNotNull("Clone's item not removed", clone.getAreaAt(0)); 52 } 53 } 54 | Popular Tags |