1010import java .util .List ;
1111
1212import com .genexus .msoffice .excel .style .ExcelStyle ;
13- import org .junit .*;
14-
15- import com .genexus .msoffice .excel .poi .xssf .ExcelCells ;
16- import com .genexus .msoffice .excel .poi .xssf .ExcelWorksheet ;
1713import com .genexus .msoffice .excel .style .ExcelAlignment ;
1814
15+ import org .junit .*;
1916import static org .junit .Assert .*;
2017/**
2118 * Unit test for simple App.
@@ -140,7 +137,7 @@ public void testActiveWorksheet() {
140137 public void testOpenAndSave () {
141138 ExcelSpreadsheetGXWrapper excel = create ("testActive" );
142139 try {
143- excel .getCells (2 , 1 , 5 , 5 ).setDate (new Date ());
140+ excel .getCells (2 , 1 , 5 , 5 ).setDateValue (new Date ());
144141 } catch (Exception e ) {
145142 e .printStackTrace ();
146143 }
@@ -166,7 +163,7 @@ public void testOpenAndSaveLocked() {
166163 Assert .assertEquals ("File is locked" , 7 , excel .getErrCode ());
167164
168165 try {
169- excel .getCells (2 , 1 , 5 , 5 ).setDate (new Date ());
166+ excel .getCells (2 , 1 , 5 , 5 ).setDateValue (new Date ());
170167 } catch (Exception e ) {
171168 e .printStackTrace ();
172169 }
@@ -186,7 +183,7 @@ public void testFolderNotExists() {
186183 excel .open (excel1 );
187184
188185 try {
189- excel .getCells (2 , 1 , 5 , 5 ).setDate (new Date ());
186+ excel .getCells (2 , 1 , 5 , 5 ).setDateValue (new Date ());
190187 } catch (Exception e ) {
191188 e .printStackTrace ();
192189 }
@@ -207,7 +204,7 @@ public void testWithoutExtensions() {
207204 excel .insertSheet ("genexus1" );
208205 excel .insertSheet ("genexus2" );
209206
210- List <ExcelWorksheet > wSheets = excel .getWorksheets ();
207+ List <IExcelWorksheet > wSheets = excel .getWorksheets ();
211208 Assert .assertTrue (wSheets .size () == 3 );
212209 Assert .assertTrue (wSheets .get (0 ).getName () == "genexus0" );
213210 Assert .assertTrue (wSheets .get (1 ).getName () == "genexus1" );
@@ -224,7 +221,7 @@ public void testInsertSheet() {
224221 excel .insertSheet ("genexus1" );
225222 excel .insertSheet ("genexus2" );
226223
227- List <ExcelWorksheet > wSheets = excel .getWorksheets ();
224+ List <IExcelWorksheet > wSheets = excel .getWorksheets ();
228225 Assert .assertTrue (wSheets .size () == 3 );
229226 Assert .assertTrue (wSheets .get (0 ).getName () == "genexus0" );
230227 Assert .assertTrue (wSheets .get (1 ).getName () == "genexus1" );
@@ -243,7 +240,7 @@ public void testDeleteSheet() {
243240 excel .insertSheet ("gx3" );
244241 excel .insertSheet ("gx4" );
245242
246- List <ExcelWorksheet > wSheets = excel .getWorksheets ();
243+ List <IExcelWorksheet > wSheets = excel .getWorksheets ();
247244 Assert .assertTrue (wSheets .size () == 4 );
248245 Assert .assertTrue (wSheets .get (0 ).getName () == "gx1" );
249246 Assert .assertTrue (wSheets .get (1 ).getName () == "gx2" );
@@ -432,7 +429,7 @@ public void testGetWorksheets() {
432429 excel .save ();
433430 excel .close ();
434431 excel = open ("testGetWorksheets" );
435- List <ExcelWorksheet > sheets = excel .getWorksheets ();
432+ List <IExcelWorksheet > sheets = excel .getWorksheets ();
436433 assertEquals ("hoja1" , sheets .get (0 ).getName ());
437434 assertEquals ("hoja2" , sheets .get (1 ).getName ());
438435 assertEquals ("hoja3" , sheets .get (2 ).getName ());
@@ -454,7 +451,7 @@ public void testHiddenCells() {
454451 excel .getCells (1 , 1 , 3 , 3 ).setCellStyle (style );
455452
456453
457- ExcelCells cells = excel .getCells (5 , 1 , 3 , 3 );
454+ ExcelCellsGXWrapper cells = excel .getCells (5 , 1 , 3 , 3 );
458455 cells .setText ("texto SI se puede editar" );
459456 style = new ExcelStyle ();
460457 style .setLocked (false );
@@ -476,7 +473,7 @@ public void testProtectSheet() {
476473 excel .getCells (1 , 1 , 3 , 3 ).setCellStyle (style );
477474
478475
479- ExcelCells cells = excel .getCells (5 , 1 , 3 , 3 );
476+ ExcelCellsGXWrapper cells = excel .getCells (5 , 1 , 3 , 3 );
480477 cells .setText ("texto SI se puede editar" );
481478 style = new ExcelStyle ();
482479 style .setLocked (false );
@@ -542,7 +539,7 @@ public void testCloneSheet() {
542539 excel .save ();
543540 excel .close ();
544541 excel = open ("testCloneSheet" );
545- List <ExcelWorksheet > sheets = excel .getWorksheets ();
542+ List <IExcelWorksheet > sheets = excel .getWorksheets ();
546543 Assert .assertEquals (4 , sheets .size ());
547544 excel .close ();
548545 }
@@ -556,7 +553,7 @@ public void testCloneSheet2() {
556553 excel .save ();
557554 excel .close ();
558555 excel = open ("testCloneSheet2" );
559- List <ExcelWorksheet > sheets = excel .getWorksheets ();
556+ List <IExcelWorksheet > sheets = excel .getWorksheets ();
560557 Assert .assertEquals (2 , sheets .size ());
561558 excel .close ();
562559 }
@@ -579,7 +576,7 @@ public void testCloneSheetError() {
579576 excel .save ();
580577 excel .close ();
581578 excel = open ("testCloneSheetError" );
582- List <ExcelWorksheet > sheets = excel .getWorksheets ();
579+ List <IExcelWorksheet > sheets = excel .getWorksheets ();
583580 Assert .assertEquals (4 , sheets .size ());
584581 excel .close ();
585582 }
@@ -600,7 +597,7 @@ public void testWorksheetRename() {
600597 excel .save ();
601598 excel .close ();
602599 excel = open ("testWorksheetRename" );
603- List <ExcelWorksheet > sheets = excel .getWorksheets ();
600+ List <IExcelWorksheet > sheets = excel .getWorksheets ();
604601 assertEquals ("hoja1" , sheets .get (1 ).getName ());
605602 assertEquals ("hoja2" , sheets .get (2 ).getName ());
606603 assertEquals ("modificada" , sheets .get (3 ).getName ());
@@ -1026,7 +1023,7 @@ public void testAutoFit() {
10261023 excel .getCells (1 , 3 , 1 , 1 ).setText ("VERYLONGTEXTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTTT" );
10271024 excel .getCells (2 , 4 , 1 , 1 ).setText ("hola!" );
10281025 excel .getCells (6 , 6 , 1 , 1 ).setText ("VERYLONGTEXTINDIFFERENTROWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWWW" );
1029- ExcelCells cells = excel .getCells (7 , 7 , 1 , 1 );
1026+ ExcelCellsGXWrapper cells = excel .getCells (7 , 7 , 1 , 1 );
10301027 ExcelStyle style = new ExcelStyle ();
10311028 style .setDataFormat ("#.##" ); //change style, so it shows the full number not scientific notation
10321029 cells .setNumericValue (new BigDecimal ("123456789123456789123456789" ));
@@ -1041,7 +1038,7 @@ public void testDateFormat() {
10411038 excel .setAutofit (true );
10421039 Date date = new Date ();
10431040 //sets date with default format
1044- ExcelCells cells = excel .getCells (1 , 1 , 1 , 1 );
1041+ ExcelCellsGXWrapper cells = excel .getCells (1 , 1 , 1 , 1 );
10451042 cells .setDateValue (date );
10461043 //sets date and apply format after
10471044 cells = excel .getCells (2 , 1 , 1 , 1 );
0 commit comments