KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > poi > hssf > model > TestSheet


1
2 /* ====================================================================
3    Copyright 2002-2004 Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16 ==================================================================== */

17         
18
19 package org.apache.poi.hssf.model;
20
21 import junit.framework.TestCase;
22 import org.apache.poi.hssf.usermodel.HSSFSheet;
23 import org.apache.poi.hssf.record.BOFRecord;
24 import org.apache.poi.hssf.record.EOFRecord;
25 import org.apache.poi.hssf.record.DimensionsRecord;
26 import org.apache.poi.hssf.record.aggregates.RowRecordsAggregate;
27 import org.apache.poi.hssf.record.aggregates.ValueRecordsAggregate;
28 import org.apache.poi.hssf.record.aggregates.ColumnInfoRecordsAggregate;
29
30 import java.util.List JavaDoc;
31 import java.util.ArrayList JavaDoc;
32
33 /**
34  * Unit test for the Sheet class.
35  *
36  * @author Glen Stampoultzis (glens at apache.org)
37  */

38 public class TestSheet extends TestCase
39 {
40     public void testCreateSheet() throws Exception JavaDoc
41     {
42         // Check we're adding row and cell aggregates
43
List JavaDoc records = new ArrayList JavaDoc();
44         records.add( new BOFRecord() );
45         records.add( new DimensionsRecord() );
46         records.add( new EOFRecord() );
47         Sheet sheet = Sheet.createSheet( records, 0, 0 );
48
49         int pos = 0;
50         assertTrue( sheet.records.get(pos++) instanceof BOFRecord );
51         assertTrue( sheet.records.get(pos++) instanceof ColumnInfoRecordsAggregate );
52         assertTrue( sheet.records.get(pos++) instanceof DimensionsRecord );
53         assertTrue( sheet.records.get(pos++) instanceof RowRecordsAggregate );
54         assertTrue( sheet.records.get(pos++) instanceof ValueRecordsAggregate );
55         assertTrue( sheet.records.get(pos++) instanceof EOFRecord );
56     }
57
58 }
59
Popular Tags